के लिए ज़ैमरिन का उपयोग करके एक चल रहे एंड्रॉइड ऐप को डीबग करें जब ऐप शुरू होता है तो मुझे ऑफ़लाइन होने पर स्थानीय स्टोरेज से एक सूची लोड हो रही है, या यदि कोई नेटवर्क कनेक्शन है तो यह इस सूची को वेब सेवा से लोड करेगा (और फिर लिखें स्थानीय भंडारण।विजुअल स्टूडियो
मेरे मुद्दा यह है कि मुझे इस डिबग करने के लिए, मैं पूरी तरह से ऐप्स को बंद और फिर उसे पुनरारंभ
एप्लिकेशन बूट होगा (इसलिए दृश्य स्टूडियो डिबग सत्र समाप्त), लेकिन जब मैं एक कॉल करने की आवश्यकता है एक बार ऐप शुरू हो जाने के बाद विशेष विधि यह दुर्घटनाग्रस्त हो जाती है। मैं यह पता नहीं लगा सकता कि यह कहां गिर रहा है। और डीबग सत्र अब संलग्न नहीं है, जो कि कोई मदद नहीं है।
अजीब चीज है। मैंने विधि कॉल और पद्धति की सामग्री को एक कोशिश पकड़ने की कोशिश में भी कोशिश की है (कोशिश करने और गलत करने का पता लगाने के लिए) और यह अभी भी गिर रहा है।
यहां खंड है।
class MyCouncilsFragment:Fragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
//my councils
base.OnCreateView(inflater, container, savedInstanceState);
var view = this.View ?? inflater.Inflate(Resource.Layout.mycouncils, container, false);
string councils = GoIO.LoadText(CC.FILE_MYCOUNCILS) ?? "";
List<Council> mycouncils = Shared.Serialization.Deserialize<List<Shared.Council>>(councils) ?? new List<Council>();
MyGlobals.myCouncilsList = mycouncils;
Spinner spncouncils = view.FindViewById<Spinner>(Resource.Id.spnCouncils);
if(mycouncils.Count > 0)
{
spncouncils.Enabled = true;
CouncilSpinnerAdapter adapter = new CouncilSpinnerAdapter(Main_Act.context, Resource.Layout.spn_row_text, MyGlobals.myCouncilsList.ToArray());
spncouncils.Adapter = adapter;
Button btnSelect = view.FindViewById<Button>(Resource.Id.btnSelect);
btnSelect.Enabled = true;
btnSelect.Click += delegate
{
Council sessionCouncil = MyGlobals.myCouncilsList[spncouncils.SelectedItemPosition];
//sessionCouncil is not the problem, i've tested that
try
{
Main_Act.loadLists();
//the issue is when this method is called. (however the call works fine when calling it from a different fragment thats basically in the same state)
}
catch
{
}
//List<Designer> x = Shared.WebServerHelper.WebCall<Designer>("https://" + MyGlobals.sessionCouncil.service_url + "/design/");
//MyGlobals.sessionColours = x[0];
//MyGlobals.hintText = MyGlobals.getSubtleColour(MyGlobals.getColor(MyGlobals.sessionColours.controlcolour), 20);
//var intent = new Intent(this.Activity, typeof(MyDetails_Act));
//StartActivity(intent);
};
}
else
{
//List<Council> emptylist = new List<Council>();
//Council empty = new Council();
//empty.council_name = "no councils added";
//emptylist.Add(empty);
//spncouncils.Enabled = false;
//Button viewall = view.FindViewById<Button>(Resource.Id.btnSelect);
//viewall.Visibility = ViewStates.Gone;
//TextView nb = view.FindViewById<TextView>(Resource.Id.nb);
//nb.Visibility = ViewStates.Visible;
}
return view;
}
और इस पद्धति है कि कहा जाता है की जा रही है
public static void loadLists()
{
try
{
// // _| _|_| _|_| _|_|_|
// // _| _| _| _| _| _| _|
// // _| _| _| _|_|_|_| _| _|
// // _| _| _| _| _| _| _|
// // _|_|_|_| _|_| _| _| _|_|_|
if (MyGlobals.sessionCouncil != null)
{
var connectivityManager = (ConnectivityManager)context.GetSystemService(ConnectivityService);
var activeConnection = connectivityManager.ActiveNetworkInfo;
if (activeConnection != null && activeConnection.IsConnected)
{
loadConsentsFromWeb();
Console.WriteLine("getting inspectiontypes online");
loadInspectionTypesOnline();
}
else
{
try
{
loadConsentsFromFile();
loadInspectionTypesOffline();
}
catch
{
Toast.MakeText(context, "Unable to load consents from file", ToastLength.Long).Show();
}
}
try
{
loadBookings();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
else
{
//inspection types failed to load from file or from web. propmt user to reaload app? or something?
Toast.MakeText(context, "Definition Elements failed to load, please restart the app", ToastLength.Short).Show();
System.Environment.Exit(0);
}
}
catch
{
}
}
सूचना है, मैं एक कोशिश ब्लॉक में पूरे विधि डालने की कोशिश की है और एप्लिकेशन को अभी भी गिर रही है
क्या आप डीबग करने का प्रयास करते समय आउटपुट में त्रुटि संदेश में कुछ है ?, क्या आपने एंड्रॉइड डिवाइस मॉनीटर (डीडीएमएस) खोलने की कोशिश की है और लॉगकैट से आउटपुट को देखने का प्रयास किया है? – arnfada
वैश्विक अपवाद हैंडलर संलग्न करें और कॉल बैक में ब्रेक-पॉइंट डालें, इससे आपको क्या हो रहा है में अंतर्दृष्टि मिलनी चाहिए: http://stackoverflow.com/a/11450361/1099111 – matthewrdev
इसके अलावा, कृपया एक लॉगकट शामिल करें दुर्घटना। – matthewrdev