I'm very new to Xamarin and mobile development, but have an experience with C#.
Following is my attempt to take some code from the web and adjusting it to Xamarin.
The code fails on exception, while placing a call.
I, actually, can't reach breakpoints in my CallReceiver / PhonecallReceiver classes.
I'm running VS2017 community, API23, arm phone.
What I'm missing?
MainActivity:
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Telephony;
using Java.Lang;
using String = System.String;
using System.Collections.Generic;
using Java.Util;
using Javax.Security.Auth;
namespace CallManipulation
{
public abstract class PhonecallReceiver : BroadcastReceiver
{
private static CallState lastState = CallState.Idle;
private static DateTime callStartTime;
private static bool isIncoming;
private static String savedNumber;
public override void OnReceive(Context context, Intent intent)
{
if (intent.Action.Equals("android.intent.action.NEW_OUTGOING_CALL"))
{
savedNumber = intent.Extras.GetString("android.intent.extra.PHONE_NUMBER");
}
else
{
String stateStr = intent.Extras.GetString(TelephonyManager.ExtraState);
String number = intent.Extras.GetString(TelephonyManager.ExtraIncomingNumber);
CallState state = CallState.Idle;
if (stateStr.Equals(TelephonyManager.ExtraStateIdle))
{
state = CallState.Idle;
}
else if (stateStr.Equals(TelephonyManager.ExtraStateOffhook))
{
state = CallState.Offhook;
}
else if (stateStr.Equals(TelephonyManager.ExtraStateRinging))
{
state = CallState.Ringing;
}
OnCallStateChanged(context, state, number);
}
}
protected virtual void onIncomingCallStarted(Context ctx, String number, DateTime start) { }
protected virtual void onOutgoingCallStarted(Context ctx, String number, DateTime start) { }
protected virtual void onIncomingCallEnded(Context ctx, String number, DateTime start, DateTime end) { }
protected virtual void onOutgoingCallEnded(Context ctx, String number, DateTime start, DateTime end) { }
protected virtual void onMissedCall(Context ctx, String number, DateTime start) { }
public void OnCallStateChanged(Context context, CallState state, string number)
{
if (lastState == state)
return;
switch (state)
{
case CallState.Ringing:
isIncoming = true;
callStartTime = new DateTime().Date;
savedNumber = number;
onIncomingCallStarted(context, number, callStartTime);
break;
case CallState.Offhook:
if (lastState != CallState.Ringing)
{
isIncoming = false;
callStartTime = new DateTime().Date;
onOutgoingCallStarted(context, savedNumber, callStartTime);
}
break;
case CallState.Idle:
if (lastState == CallState.Ringing)
onMissedCall(context, savedNumber, callStartTime);
else if (isIncoming)
onIncomingCallEnded(context, savedNumber, callStartTime, new DateTime().Date);
else
onOutgoingCallEnded(context, savedNumber, callStartTime, new DateTime().Date);
break;
}
lastState = state;
}
}
public class CallReceiver : PhonecallReceiver
{
protected override void onIncomingCallStarted(Context ctx, string number, DateTime start)
{
}
protected override void onOutgoingCallStarted(Context ctx, string number, DateTime start)
{
}
protected override void onIncomingCallEnded(Context ctx, string number, DateTime start, DateTime end)
{
}
protected override void onOutgoingCallEnded(Context ctx, string number, DateTime start, DateTime end)
{
}
protected override void onMissedCall(Context ctx, string number, DateTime start)
{
}
}
[Activity(Label = "CallManipulation", MainLauncher = true, Icon = "#drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
}
}
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="CallManipulation.CallManipulation" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<application android:label="CallManipulation">
<!--This part is inside the application-->
<receiver android:name=".CallReceiver" >
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
</application>
</manifest>
Output window:
08-01 15:53:29.279 D/Mono ( 2601): [0x9f7fd930] worker starting
08-01 15:53:29.308 D/Mono ( 2601): DllImport searching in: '__Internal' ('(null)').
08-01 15:53:29.308 D/Mono ( 2601): Searching for 'java_interop_jnienv_call_void_method_a'.
08-01 15:53:29.308 D/Mono ( 2601): Probing 'java_interop_jnienv_call_void_method_a'.
08-01 15:53:29.308 D/Mono ( 2601): Found as 'java_interop_jnienv_call_void_method_a'.
08-01 15:53:29.316 E/AndroidRuntime( 2601): FATAL EXCEPTION: main
08-01 15:53:29.316 E/AndroidRuntime( 2601): Process: CallManipulation.CallManipulation, PID: 2601
08-01 15:53:29.316 E/AndroidRuntime( 2601): java.lang.RuntimeException: Unable to instantiate receiver CallManipulation.CallManipulation.CallReceiver: java.lang.ClassNotFoundException: Didn't find class "CallManipulation.CallManipulation.CallReceiver" on path: DexPathList[[zip file "/data/app/CallManipulation.CallManipulation-1/base.apk"],nativeLibraryDirectories=[/data/app/CallManipulation.CallManipulation-1/lib/arm, /data/app/CallManipulation.CallManipulation-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2706)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.-wrap14(ActivityThread.java)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.os.Handler.dispatchMessage(Handler.java:102)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.os.Looper.loop(Looper.java:148)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.main(ActivityThread.java:5417)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.reflect.Method.invoke(Native Method)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-01 15:53:29.316 E/AndroidRuntime( 2601): Caused by: java.lang.ClassNotFoundException: Didn't find class "CallManipulation.CallManipulation.CallReceiver" on path: DexPathList[[zip file "/data/app/CallManipulation.CallManipulation-1/base.apk"],nativeLibraryDirectories=[/data/app/CallManipulation.CallManipulation-1/lib/arm, /data/app/CallManipulation.CallManipulation-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
08-01 15:53:29.316 E/AndroidRuntime( 2601): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2701)
08-01 15:53:29.316 E/AndroidRuntime( 2601): ... 8 more
08-01 15:53:29.316 E/AndroidRuntime( 2601): Suppressed: java.lang.ClassNotFoundException: CallManipulation.CallManipulation.CallReceiver
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.Class.classForName(Native Method)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
08-01 15:53:29.316 E/AndroidRuntime( 2601): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
08-01 15:53:29.316 E/AndroidRuntime( 2601): ... 10 more
08-01 15:53:29.316 E/AndroidRuntime( 2601): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Related
I recently updated my App to Xamarin Forms 5.0 and therefore to AndroidX. I upgraded all packages, which still referenced the old Android Support Libraries and replaced all occurrences of Android Support Library References in my code with the equivalent reference from AndroidX.
But my App keeps crashing on startup, with following exception:
[AndroidRuntime] android.runtime.JavaProxyThrowable: System.InvalidCastException: Unable to convert instance of type 'Android.Widget.LinearLayout' to type 'AndroidX.AppCompat.Widget.Toolbar'.
[AndroidRuntime] at Java.Interop.JavaObjectExtensions.CastClass (Android.Runtime.IJavaObject instance, System.Type resultType) [0x0005d] in <1410c4afb1fd4823a12ecf897dd92287>:0
[AndroidRuntime] at Java.Interop.JavaObjectExtensions._JavaCast[TResult] (Android.Runtime.IJavaObject instance) [0x00052] in <1410c4afb1fd4823a12ecf897dd92287>:0
[AndroidRuntime] at Java.Interop.JavaObjectExtensions.JavaCast[TResult] (Android.Runtime.IJavaObject instance) [0x00000] in <1410c4afb1fd4823a12ecf897dd92287>:0
[AndroidRuntime] at Android.Runtime.Extensions.JavaCast[TResult] (Android.Runtime.IJavaObject instance) [0x00000] in <1410c4afb1fd4823a12ecf897dd92287>:0
[AndroidRuntime] at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnCreate (Android.OS.Bundle savedInstanceState, Xamarin.Forms.Platform.Android.ActivationFlags flags) [0x00090] in <04c545f414d24a37af95d995791bb9a9>:0
[AndroidRuntime] at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00000] in <04c545f414d24a37af95d995791bb9a9>:0
[AndroidRuntime] at MyAppDemo.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00000] in <bdc0728e30d74980ad82869dc2b7bae4>:0
[AndroidRuntime] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <1410c4afb1fd4823a12ecf897dd92287>:0
[AndroidRuntime] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.3(intptr,intptr,intptr)
[AndroidRuntime] at crc648c69828764ca3d7c.MainActivity.n_onCreate(Native Method)
[AndroidRuntime] at crc648c69828764ca3d7c.MainActivity.onCreate(MainActivity.java:43)
[AndroidRuntime] at android.app.Activity.performCreate(Activity.java:8000)
[AndroidRuntime] at android.app.Activity.performCreate(Activity.java:7984)
[AndroidRuntime] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
[AndroidRuntime] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3404)
[AndroidRuntime] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
[AndroidRuntime] at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
[AndroidRuntime] at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
[AndroidRuntime] at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
[AndroidRuntime] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:106)
[AndroidRuntime] at android.os.Looper.loop(Looper.java:223)
[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:7660)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
This is my MainActivity.OnCreate(), which is mentioned in the exception message:
[Activity(ResizeableActivity = true, Label = “My App”, Icon = "#drawable/ic_launcher", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, Theme = "#style/MyTheme", LaunchMode = LaunchMode.SingleTop)]
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
ToolbarResource = Resource.Layout.toolbar;
TabLayoutResource = Resource.Layout.tabs;
...
}
}
And this is my toolbar (Under Resources>layout>toolbar.axml):
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar // <- before replacing: android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways" />
I studied the AndroidX Migration Tutorials, did a lot of research in different forums. I found people with similar issues, but for them uninstalling the app from the device and deleting /bin and /obj folders helped. For me nothing fixed it at all.
(Btw: My iOS Version of the App is running, of course)
Solution: Remove the toolbar.axml would fix this error.
i had the same Problem back when i used Xamarin, for me it helped to change the Linking Properties under
--> Project.android -> Properies -> Anroid Options -> Linking
switch to none, try to launch your project and then switch back to sdk and user assemblies
this one did it for me
I am binding the java library Material CalendarView. With a set of 12 transforms in Metadata.xml I could bind the library with 0 errors and 15 warnings. I have added Support Library v4 Component ver 23.1.1 in the binding project as the jar file had a dependency on that. Also I have ensured that all the Resource assets are included in the jar file.
When I use this library in an Android Sample like below,
var materialCalendar= new MaterialCalendarView(this);
this exception gets thrown
Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable;
Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at --- End of managed exception stack trace ---
at java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Activity.performCreate(Activity.java:5990)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at at android.app.ActivityThread.access$800(ActivityThread.java:151)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at at android.os.Handler.dispatchMessage(Handler.java:102)
at at android.os.Looper.loop(Looper.java:135)
at at android.app.ActivityThread.main(ActivityThread.java:5254)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable
at at java.lang.Class.classForName(Native Method)
at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at ... 19 more
at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00084] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:306
at MaterialCalendarLibrary.MaterialCalendarView..ctor (Android.Content.Context p0) [0x000c5] in /Users/fingent/Projects/MaterialCalendarLibrary/MaterialCalendarLibrary/obj/Release/generated/src/MaterialCalendarLibrary.MaterialCalendarView.cs:505
at MaterialCalendarSample.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00009] in /Users/fingent/Documents/sreeraj/workspace/Xamarin.MaterialCalendarView/MaterialCalendarSample/MainActivity.cs:17
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2475
at at (wrapper dynamic-method) System.Object:0b8c341c-2f19-42d5-83e9-b3a815827e69 (intptr,intptr,intptr)
at --- End of managed exception stack trace ---
at java.lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable;
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237)
at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method)
at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Activity.performCreate(Activity.java:5990)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at at android.app.ActivityThread.access$800(ActivityThread.java:151)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at at android.os.Handler.dispatchMessage(Handler.java:102)
at at android.os.Looper.loop(Looper.java:135)
at at android.app.ActivityThread.main(ActivityThread.java:5254)
at at java.lang.reflect.Method.invoke(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:372)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]]
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at ... 18 more
at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable
at at java.lang.Class.classForName(Native Method)
at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at ... 19 more
at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Here is the link to the project in Github Xamarin Material CalendarView
It's about missing Resources that should be attached in Material CalendarView, you need an AAR file.
Just go Maven and get latest AAR file that published by Author: http://mvnrepository.com/artifact/com.prolificinteractive/material-calendarview/1.2.0
Remove the material-calendarview.jar and drag new file material-calendarview-1.2.0.aar on your binding project, done!
A Drawable is a graphic resource and the Java exception is on the following line (from the lib your binding):
buttonPast.setImageResource(R.drawable.mcv_action_previous);
So you are missing mcv_action_previous which a PNG-based arrow located in the res/drawable-xxxhdpi/mcv_action_previous.png within the project that you are binding.
Are all the resources included? Any of your binding transformations or binding warning about resources?
I am currently developing a Xamarin app and all of a sudden my Android app started crashing on LoginActivity. I have researched a lot on "
Java.Lang.ClassNotFoundException: Didn't find class
"android.support.v7.appcompat.R$styleable" on path
"
Tried things like updating Android SDK, deleting bin and obj folder. Looking at stacktrace it seems to be an issue with MvvmCross. Currently I am using 3.5.1 of MvvmCross.
Another fact is that I am the only one in team who is facing this issue.
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] --- End of managed exception stack trace ---
[MonoDroid] java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[MonoDroid] at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.n_onCreate(Native Method)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.onCreate(LoginActivity.java:31)
[MonoDroid] at android.app.Activity.performCreate(Activity.java:5990)
[MonoDroid] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[MonoDroid] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
[MonoDroid] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
[MonoDroid] at android.app.ActivityThread.access$800(ActivityThread.java:151)
[MonoDroid] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid] at android.os.Looper.loop(Looper.java:135)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid] at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[MonoDroid] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
[MonoDroid] at java.lang.Class.classForName(Native Method)
[MonoDroid] at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[MonoDroid] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[MonoDroid] ... 19 more
[MonoDroid] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[MonoDroid] --- End of inner exception stack trace ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0xa047bf80 + 0x0002b> in <filename unknown>:0
[MonoDroid] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) <0xa2007008 + 0x000b3> in <filename unknown>:0
[MonoDroid] at Android.App.Activity.OnCreate (Android.OS.Bundle savedInstanceState) <0xa1018918 + 0x0014f> in <filename unknown>:0
[MonoDroid] at ACS.FundRaising.Android.MvxActionBarEventSourceActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b4e0 + 0x00037> in <filename unknown>:0
[MonoDroid] at ACS.FundRaising.Android.LoginActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b278 + 0x0001b> in <filename unknown>:0
[MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) <0xa116f9b0 + 0x00057> in <filename unknown>:0
[MonoDroid] at (wrapper dynamic-method) System.Object:dd5e6f9d-f207-497c-b5c3-0a2c9dac76e7 (intptr,intptr,intptr)
[MonoDroid] --- End of managed exception stack trace ---
[MonoDroid] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[MonoDroid] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[MonoDroid] at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.n_onCreate(Native Method)
[MonoDroid] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.onCreate(LoginActivity.java:31)
[MonoDroid] at android.app.Activity.performCreate(Activity.java:5990)
[MonoDroid] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[MonoDroid] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
[MonoDroid] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
[MonoDroid] at android.app.ActivityThread.access$800(ActivityThread.java:151)
[MonoDroid] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid] at android.os.Looper.loop(Looper.java:135)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:5254)
[MonoDroid] at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] at java.lang.reflect.Method.invoke(Method.java:372)
[MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[MonoDroid] Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[MonoDroid] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[MonoDroid] ... 18 more
[MonoDroid] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
[MonoDroid] at java.lang.Class.classForName(Native Method)
[MonoDroid] at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[MonoDroid] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[MonoDroid] ... 19 more
[MonoDroid] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[Mono] Assembly Ref addref GoogleAnalytics.Core[0xb429abe0] -> System.Net.Http[0xaed233a0]: 3
[Mono] Assembly Ref addref GoogleAnalytics.Core[0xb429abe0] -> System.Core[0xb4387580]: 7
[Mono] Assembly Ref addref System.Net.Http[0xaed233a0] -> System[0xb4387760]: 10
[Mono] Assembly Ref addref System.Net.Http[0xaed233a0] -> System.Core[0xb4387580]: 8
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[mono-rt]
[mono-rt] --- End of managed exception stack trace ---
[mono-rt] java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/org.cancer.fundraising-1/base.apk"],nativeLibraryDirectories=[/data/app/org.cancer.fundraising-1/lib/x86, /vendor/lib, /system/lib]]
[mono-rt] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[mono-rt] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[mono-rt] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[mono-rt] at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
[mono-rt] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.n_onCreate(Native Method)
[mono-rt] at md5da1044ae077a2d5a79e87e5c6bedf113.LoginActivity.onCreate(LoginActivity.java:31)
[mono-rt] at android.app.Activity.performCreate(Activity.java:5990)
[mono-rt] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
[mono-rt] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
[mono-rt] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
[mono-rt] at android.app.ActivityThread.access$800(ActivityThread.java:151)
[mono-rt] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
[mono-rt] at android.os.Handler.dispatchMessage(Handler.java:102)
[mono-rt] at android.os.Looper.loop(Looper.java:135)
[mono-rt] at android.app.ActivityThread.main(ActivityThread.java:5254)
[mono-rt] at java.lang.reflect.Method.invoke(Native Method)
[mono-rt] at java.lang.reflect.Method.invoke(Method.java:372)
[mono-rt] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
[mono-rt] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
[mono-rt] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
[mono-rt] at java.lang.Class.classForName(Native Method)
[mono-rt] at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[mono-rt] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[mono-rt] ... 19 more
[mono-rt] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
[mono-rt]
[mono-rt] --- End of inner exception stack trace ---
[mono-rt] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0xa047bf80 + 0x0002b> in <filename unknown>:0
[mono-rt] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) <0xa2007008 + 0x000b3> in <filename unknown>:0
[mono-rt] at Android.App.Activity.OnCreate (Android.OS.Bundle savedInstanceState) <0xa1018918 + 0x0014f> in <filename unknown>:0
[mono-rt] at ACS.FundRaising.Android.MvxActionBarEventSourceActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b4e0 + 0x00037> in <filename unknown>:0
[mono-rt] at ACS.FundRaising.Android.LoginActivity.OnCreate (Android.OS.Bundle bundle) <0xa047b278 + 0x0001b> in <filename unknown>:0
[mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) <0xa116f9b0 + 0x00057> in <filename unknown>:0
[mono-rt] at (wrapper dynamic-method) System.Object:dd5e6f9d-f207-497c-b5c3-0a2c9dac76e7 (intptr,intptr,intptr)
[mono-rt] --- End of managed exception stack trace ---
[mono-rt] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;
[mono-rt] at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:118)
[mono-rt] at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
[mono-rt] at android.support.v7.app.AppCompatActivity.onCreate(AppCompa
In my case a solution Clean was necessary to get it working.
This issue is resolved by Re-Cloning the repository. Still I don't know what caused the issue but I ended up wasting lot of time. I tried things like;
Removing and downloading packages
Deleting Obj/Bin
Deleting appcompat from android SDK install folder and re-downloading it
Using component instead of package
Probably build output generated some garbage resulting in such issue.
12-21 16:36:20.522 24309-24309/islamicapp.com.ranatechnology.ww.tawfiiqislamiccenter E/AndroidRuntime: FATAL EXCEPTION: main
Process: islamicapp.com.ranatechnology.ww.tawfiiqislamiccenter, PID: 24309
java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again
at java.lang.VMThread.create(Native Method)
at java.lang.Thread.start(Thread.java:1029)
at com.android.volley.RequestQueue.start(RequestQueue.java:152)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:79)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:105)
at com.android.volley.toolbox.Volley.newRequestQueue(Volley.java:115)
at islamicapp.com.ranatechnology.ww.Service.NotificationService.servicestart(NotificationService.java:139)
at islamicapp.com.ranatechnology.ww.Service.NotificationService.onStartCommand(NotificationService.java:58)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2712)
at android.app.ActivityThread.access$2100(ActivityThread.java:142)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5120)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
I have a problem with using the Jersey Client
I am using jersey-bundle-1.17.1.jar
When i try to create a Client i throw at Runtime.
Client c = Client.create();
logcat:
01-29 12:46:52.578 13862-13862/com.example.spar.navigationdrawer E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.spar.navigationdrawer, PID: 13862
java.lang.VerifyError: com/sun/jersey/core/impl/provider/entity/MimeMultipartProvider
at java.lang.Class.getDeclaredConstructors(Native Method)
at java.lang.Class.getConstructors(Class.java:508)
at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:174)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
at com.sun.jersey.api.client.Client.init(Client.java:342)
at com.sun.jersey.api.client.Client.access$000(Client.java:118)
at com.sun.jersey.api.client.Client$1.f(Client.java:191)
at com.sun.jersey.api.client.Client$1.f(Client.java:187)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.api.client.Client.<init>(Client.java:187)
at com.sun.jersey.api.client.Client.<init>(Client.java:159)
at com.sun.jersey.api.client.Client.create(Client.java:669)
at com.example.spar.navigationdrawer.client.ArticleClient.getArticles(ArticleClient.java:38)
at com.example.spar.navigationdrawer.MyActivity.<init>(MyActivity.java:72)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)