I got the error in Intent.cs
I added android.annotation in app.gradle with.
"
When I call class with
Intent next = new Intent(MainMenu.this, MainActivity.class);
I got the runtime error.Error message is
"03-05 09:52:19.210 1339-1339/com.example.tesingphootc55 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.tesingphootc55, PID: 1339
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/example/tesingphootc55/MainActivity;
at com.example.tesingphootc55.MainMenu$CheckSequentialClosing.onPostExecute(MainMenu.java:2125)
at com.example.tesingphootc55.MainMenu$CheckSequentialClosing.onPostExecute(MainMenu.java:2092)
at android.os.AsyncTask.finish(AsyncTask.java:636)
at android.os.AsyncTask.access$500(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5276)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.tesingphootc55.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.tesingphootc55-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.tesingphootc55-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.example.tesingphootc55.MainMenu$CheckSequentialClosing.onPostExecute(MainMenu.java:2125)
at com.example.tesingphootc55.MainMenu$CheckSequentialClosing.onPostExecute(MainMenu.java:2092)
at android.os.AsyncTask.finish(AsyncTask.java:636)
at android.os.AsyncTask.access$500(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5276)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:706)
Suppressed: java.lang.NoClassDefFoundError: com.example.tesingphootc55.MainActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.example.tesingphootc55.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class is not found using the boot class loader; no stack available
"
One possible solution which I had also tried was to disable Instant run goto File -> Settings -> Build,Execution, Deployment -> Instant Run -> Uncheck the checkbox for instant run.
Clean you project before running it on your device.
Edit
Make sure to enable multidex option if your app and the libraries it references exceed 65k methods limit. For multidex support in gradle build add in dependencies
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
And in defaultConfig add multiDexEnabled
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
}
For more information on multidex please visit android developer link
Change dependencies as attached picture.It can solve that problem.
Related
I just updated Android Studio 3.2 to 3.3. It updated the Gradle plugin in my project from 3.2.1 to 3.3. Now enabling advanced profiling in Run/Debug configuration making my app crash. Clean/Rebuild/Invalidate caches don't help.
I found one way to make it work: rolling plugin back to 3.2.1 (in project build.gradle)
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
Is there any other way?
01-15 13:38:31.527 6969-6969/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.appcard.androidterminal, PID: 6969
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/android/tools/profiler/support/ProfilerService;
at com.appcard.androidterminal.AppContext.<init>(AppContext.java:53)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1606)
at android.app.Instrumentation.newApplication(Instrumentation.java:1000)
at android.app.Instrumentation.newApplication(Instrumentation.java:985)
at android.app.LoadedApk.makeApplication(LoadedApk.java:567)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4837)
at android.app.ActivityThread.access$1500(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5643)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.android.tools.profiler.support.ProfilerService" on path: DexPathList[[zip file "/data/app/com.appcard.androidterminal-1/base.apk"],nativeLibraryDirectories=[/data/app/com.appcard.androidterminal-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.appcard.androidterminal.AppContext.<init>(AppContext.java:53)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1606)
at android.app.Instrumentation.newApplication(Instrumentation.java:1000)
at android.app.Instrumentation.newApplication(Instrumentation.java:985)
at android.app.LoadedApk.makeApplication(LoadedApk.java:567)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4837)
at android.app.ActivityThread.access$1500(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5643)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Suppressed: java.lang.ClassNotFoundException: com.android.tools.profiler.support.ProfilerService
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I filled a bug, here is Google dev response:
I was able to reproduce the issue with emulator API 25 and lower.
Workaround is to use device/emulator API of 26 or higher.
https://issuetracker.google.com/issues/122944954#comment4
Update:
Yes, this has been fixed. The fix won't be in 3.3.1, but it will be in the following release.
I had been contacted to put a new library in the form of an AAR into my application. It worked fine before adding this AAR, but after that, every time I start it up, it crashes with the following stacktrace:
09-10 21:10:55.272 10354-10354/? W/System.err: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/tasks/TaskCompletionSource;
at com.google.firebase.remoteconfig.FirebaseRemoteConfig.zza(Unknown Source)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig.fetch(Unknown Source)
at com.picmix.mobile.activity.SplashActivity.onCreate(SplashActivity.java:89)
at android.app.Activity.performCreate(Activity.java:6093)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2458)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.access$1000(ActivityThread.java:164)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1462)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.tasks.TaskCompletionSource" on path: DexPathList[[zip file "/data/app/com.picmix.mobile-2/base.apk"],nativeLibraryDirectories=[/data/app/com.picmix.mobile-2/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.tasks.TaskCompletionSource
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
From my experience, this kind of error is because I hadn't enabled MultiDex support. The strange thing is that I have it enabled, my gradle file contains the following line:
compile 'com.android.support:multidex:1.0.3'
The application I use in the manifest extends MultiDexApplication instead of just Application.
So is it something with that AAR?
Started getting this error after updating the value of minSdkVersion to 21 from 19. It occurs only on 5.0 devices, devices with OS 6+ works fine
Application has all the multidex properties included. Also as suggested by google that multidex is not require if minSdkVersion is 21 but that too does throws the similar error.
Tried cleaning the project, cache etc
Tried disabling the instant run but no luck so far.
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/agent/android/instrumentation/GsonInstrumentation;
at com.demo.app.persistence.Datastore.getMember(Datastore.java:142)
at com.demo.app.Application.initDatastore(Application.java:139)
at com.demo.app.Application.onCreate(Application.java:84)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.newrelic.agent.android.instrumentation.GsonInstrumentation" on path: DexPathList[[zip file "/data/app/com.demo.apptracker-1/base.apk"],nativeLibraryDirectories=[/data/app/com.babycenter.pregnancytracker-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.demo.app.persistence.Datastore.getMember(Datastore.java:142)
at com.demo.app.Application.initDatastore(Application.java:139)
at com.demo.app.Application.onCreate(Application.java:84)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Suppressed: java.lang.ClassNotFoundException: com.newrelic.agent.android.instrumentation.GsonInstrumentation
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I have been trying to solve below issue from 3 days.
Problem : Created new module as a library in android project and created aar file using assembleDebug.
That aar file i have added in another project as a new module ( dependecies also added ) but after installing the app into the device i am getting below error :
6055-26055/com.sampledemo.box8demo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sampledemo.box8demo, PID: 26055
java.lang.RuntimeException: Unable to instantiate application com.NerdNow.NerdNowApplication: java.lang.ClassNotFoundException: Didn't find class "com.NerdNow.NerdNowApplication" on path: DexPathList[[zip file "/data/app/com.sampledemo.box8demo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.sampledemo.box8demo-1/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:580)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4699)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.NerdNow.NerdNowApplication" on path: DexPathList[[zip file "/data/app/com.sampledemo.box8demo-1/base.apk"],nativeLibraryDirectories=[/data/app/com.sampledemo.box8demo-1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:982)
at android.app.LoadedApk.makeApplication(LoadedApk.java:575)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4699)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Suppressed: java.lang.NoClassDefFoundError: com.NerdNow.NerdNowApplication
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 13 more
Suppressed: java.lang.ClassNotFoundException: com.NerdNow.NerdNowApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I have enabled multidex in gradle file as well as extended MultiDexApplication in Application class
Also added multidex dependecy in gradle file
please help me to resolve this issue.
Ok Guys, after many try i found that you can not add dependencies on aar files. you have to include jar for each dependencies.
The Newrelic Android plugin is being run on a project that has no references to Newrelic. I have another project open that does use Newrelic, and I'm using Android Studio 2.2, gradle in-process daemon, and the latest Gradle and build tools:
classpath 'com.android.tools.build:gradle:2.2.0'
and
compileSdkVersion 24
buildToolsVersion '24.0.2'
In my other project which does use Newrelic, I'm using
classpath "com.newrelic.agent.android:agent-gradle-plugin:5.+"
and
apply plugin: 'newrelic'
compile 'com.newrelic.agent.android:android-agent:5.+'
I can see the newrelic class re-write logs in the output, which should not happen
[newrelic.info] [my.class.Name] replacing call to com/google/gson/Gson.fromJson(Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object; with com/newrelic/agent/android/instrumentation/GsonInstrumentation.fromJson(Lcom/google/gson/Gson;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object; (with instance check)
This then caused my apk to be built somehow missing several Activity classes, so crashes with:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{my.package/my.package.activity.home.LobbyActivity}: java.lang.ClassNotFoundException: Didn't find class "my.package.activity.home.LobbyActivity" on path: DexPathList[[zip file "/data/app/my.package-2/base.apk"],nativeLibraryDirectories=[/data/app/my.package-2/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3094)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: Didn't find class "my.package.activity.home.LobbyActivity" on path: DexPathList[[zip file "/data/app/my.package-2/base.apk"],nativeLibraryDirectories=[/data/app/my.package-2/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1095)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3084)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3350)
at android.app.ActivityThread.access$1100(ActivityThread.java:222)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Suppressed: java.lang.NoClassDefFoundError: my.package.activity.home.LobbyActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 13 more
Suppressed: java.lang.ClassNotFoundException: my.package.activity.home.LobbyActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
This is the same problem as Application crashes in onCreate due to newrelic exception, but the solutions there don't work for me. Those answers are from 2 years ago and no longer relevant (I am using a much newer Gradle version and Newrelic version, I tried deleting the .gradle and gradle project folders).