I'm using Android Studio 2.3.3, with Android Plugin for Gradle 2.3.3.
Please see my sample project, https://github.com/Uni-/AndroidModuleTest. In this project, there are two sample modules (as Android Studio names), app and library.
library has com.example.test.myapplication.MainActivity class, and it's referenced in AndroidManifest.xml of app. The application is compiled well, but it crashes on startup:
10-31 22:20:55.031 30084-30084/? I/zygote64: Late-enabling -Xcheck:jni
10-31 22:20:55.312 30084-30084/? I/InstantRun: starting instant run server: is main process
10-31 22:20:55.325 30084-30084/? D/AndroidRuntime: Shutting down VM
10-31 22:20:55.327 30084-30084/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.test.myapplication, PID: 30084
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.test.myapplication/com.example.test.myapplication.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.test.myapplication.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/base.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/lib/arm64, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2718)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.test.myapplication.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/base.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.test.myapplication-dsBQ8b1LFh9WtKzvdfrLYg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
10-31 22:20:55.328 30084-30084/? E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1173)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2708)
... 9 more
10-31 22:21:00.439 30084-30093/com.example.test.myapplication I/zygote64: Waiting for a blocking GC ObjectsAllocated
10-31 22:21:00.537 30084-30093/com.example.test.myapplication I/zygote64: WaitForGcToComplete blocked for 97.913ms for cause ObjectsAllocated
The MainActivity class seems not existing in the application artifact, according to the log.
In fact, build.gradle of app contains these lines:
debugCompile project(path: ':library', configuration: 'debugCompile')
releaseCompile project(path: ':library', configuration: 'releaseCompile')
When I replace these lines by a line below, the error goes fixed:
compile project(':library')
However, this is not what I want. I have various product flavors and custom build types in my real project, so just a compile, or even implementation in 3.0, can't be a solution.
What did I wrong in my sample project?
I fixed this by myself.
The key point is setting publishNonDefault true in build.gradle of library.
Also, the contextual dependencies should be declared as:
debugCompile project(path: ':library', configuration: 'debug')
releaseCompile project(path: ':library', configuration: 'release')
Fixed in 151f6e4. Thanks.
adding in module gradle implementation project(':yourLib') in my case solved the problem
Related
I've read a few answers on this site with the same or similar error messages, and I've tried all the solutions already. Sadly, none of them have worked so far.
My gradle files all look like they're properly set up for Multidex, the Application class extends MultiDexApplication and is referenced correctly in the manifest, I've cleaned all caches and restarted the IDE, deleting builds from the project and the device and re-building/re-installing, etc. etc.
Inspecting the APK, I found the Application in classes2.dex, correctly referencing .super Landroidx/multidex/MultiDexApplication;
The stack I'm getting is like this:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.<REDACTED>, PID: 25475
java.lang.RuntimeException: Unable to instantiate application com.<REDACTED>.Application: java.lang.ClassNotFoundException: Didn't find class "com.<REDACTED>.Application" on path: DexPathList[[zip file "/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk"],nativeLibraryDirectories=[/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1306)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7401)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7374)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2118)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.<REDACTED>.Application" on path: DexPathList[[zip file "/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk"],nativeLibraryDirectories=[/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at android.app.Instrumentation.newApplication(Instrumentation.java:1158)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1298)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7401)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7374)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2118)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:596)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Suppressed: java.io.IOException: Failed to open dex files from /data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk because: Failure to verify dex file '/data/app/~~b-NK-x066lFdY_bh0tm6ew==/com.<REDACTED>-V2WCXZvYqUZRGKbFMfmgFg==/base.apk': Bad index for method_handle_item method_idx: ffff >= de57
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:367)
at dalvik.system.DexFile.<init>(DexFile.java:109)
at dalvik.system.DexFile.<init>(DexFile.java:82)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:439)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:398)
at dalvik.system.DexPathList.<init>(DexPathList.java:166)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:129)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:104)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:116)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:114)
at android.app.ApplicationLoaders.getClassLoaderWithSharedLibraries(ApplicationLoaders.java:60)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:933)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:990)
at android.app.LoadedApk.getResources(LoadedApk.java:1234)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2788)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7263)
... 8 more
Can anyone figure out what this is all about?
In the module level build.gradle, we added these lines:
// Near the top
apply plugin: 'com.google.firebase.crashlytics'
// ...
android {
// ...
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
// ...
}
// ...
I have no idea how this fixed this crash, but I suppose that's what I get for using "It just works" libraries.
I have a problem that I always had, and tried to understand it, but never succesfully. The compatibility between firebase implementations. I take the repositories from https://mvnrepository.com/artifact/com.google.firebase , but it doesn't help me. I event put apply plugin: 'com.google.gms.google-services' at the end of build.gradle, such in dependecies.
My implementations are:
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
It works very well without last one (storage) but I needed that, and when I put it there, i get some errors. If someone can explain why it works well with some versions, and with some not, I would apreciate that.
The error i get is:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListenersCountChangedListener;
at com.google.firebase.auth.zzp.create(Unknown Source:3)
at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-common##17.0.0:66)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common##17.0.0:53)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-common##17.0.0:155)
at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common##17.0.0:642)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##17.0.0:358)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##17.0.0:321)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##17.0.0:305)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common##17.0.0:53)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common##17.0.0:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.FirebaseApp$IdTokenListenersCountChangedListener" on path: DexPathList[[zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/base.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_resources_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134).... and so on.
Upgrade the following dependencies into this:
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'com.google.firebase:firebase-storage:17.0.0'
Check the list of dependencies here:
https://firebase.google.com/support/release-notes/android#latest_sdk_versions
This question already has answers here:
Android app ClassNotFoundException for main activity
(13 answers)
Closed 12 months ago.
I am trying to build a app with Google API and i followed every steps that was given on internet to how to work with Google API, but when i run my app it launch and then closes instantly.
Logcat
04-21 19:07:19.857 16778-16778/? I/art: Late-enabling -Xcheck:jni
04-21 19:07:19.858 16778-16778/? I/art: Reinit property: dalvik.vm.checkjni= false
04-21 19:07:20.052 16778-16778/com.example.kakarot.cpecroute W/System: ClassLoader referenced unknown path: /data/app/com.example.kakarot.cpecroute-1/lib/arm64
04-21 19:07:20.065 16778-16778/? I/InstantRun: starting instant run server: is main process
04-21 19:07:20.074 16778-16778/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.kakarot.cpecroute, PID: 16778
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.kakarot.cpecroute/com.example.kakarot.cpecroute.MapsActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.kakarot.cpecroute.MapsActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.kakarot.cpecroute-1/base.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.kakarot.cpecroute-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2698)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6605)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:999)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:889)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.kakarot.cpecroute.MapsActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.kakarot.cpecroute-1/base.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.kakarot.cpecroute-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.kakarot.cpecroute-1/lib/arm64, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1083)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2688)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6605)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:999)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:889)
04-21 19:07:20.083 16778-16778/? I/Process: Sending signal. PID: 16778 SIG: 9
.............................................................................
AndroidManifest.xml/activity
#Sagar Yes, there is a activity in AndroidManifest.xml.
Below is code
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Try this :
<activity android:name="com.yourpackagename.MapsActivity" android:label="#string/title_activity_maps"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
Let me know is this works or not
I have resolved this issue by upgrading my Gradle plugin version to 7.1.1:
classpath 'com.android.tools.build:gradle:7.1.1'
I cloned this project and and copied the .so files to my project's jniLibs folder.
After that, it looked like this:
However, when I tried using the library it throws:
09-18 10:22:53.861 18439-19193/com.mopo.audiofingerprinter W/linker: libACRCloudExtrTool.so: unused DT entry: type 0x6ffffffe arg 0x4718
09-18 10:22:53.861 18439-19193/com.mopo.audiofingerprinter W/linker: libACRCloudExtrTool.so: unused DT entry: type 0x6fffffff arg 0x2
09-18 10:22:53.871 18439-19193/com.mopo.audiofingerprinter E/art: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init() (tried Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init and Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init__)
09-18 10:22:53.881 18439-19193/com.mopo.audiofingerprinter E/UncaughtException: java.lang.UnsatisfiedLinkError: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init() (tried Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init and Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init__)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init(Native Method)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.<clinit>(ACRCloudExtrTool.java:57)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.createFingerprintByFile(ACRCloudExtrTool.java:0)
at com.mopo.audiofingerprinter.tageditor.ACRCloudRecognizer.recognizeByFile(ACRCloudRecognizer.java:129)
at com.mopo.audiofingerprinter.tageditor.TestActivity$RecThread.run(TestActivity.java:84)
09-18 10:22:54.132 18439-19193/com.mopo.audiofingerprinter E/AndroidRuntime: FATAL EXCEPTION: Thread-51298
Process: com.mopo.audiofingerprinter, PID: 18439
java.lang.UnsatisfiedLinkError: No implementation found for void com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init() (tried Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init and Java_com_mopo_audiofingerprinter_tageditor_ACRCloudExtrTool_native_1init__)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.native_init(Native Method)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.<clinit>(ACRCloudExtrTool.java:57)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.createFingerprintByFile(ACRCloudExtrTool.java:0)
at com.mopo.audiofingerprinter.tageditor.ACRCloudRecognizer.recognizeByFile(ACRCloudRecognizer.java:129)
at com.mopo.audiofingerprinter.tageditor.TestActivity$RecThread.run(TestActivity.java:84)
The weird thing, is that the compiled project I cloned is working without errors. I have even attempted copying the classes from the demo and still it didn't work.
EDIT
After implementing Divy Soni's answer, the jniLibs folder disappeared entirely. And when I built the app it crashed with:
`09-18 11:21:46.848 26158-26798/com.mopo.audiofingerprinter E/UncaughtException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mopo.audiofingerprinter-1/base.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.mopo.audiofingerprinter-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mopo.audiofingerprinter-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libACRCloudExtrTool.so"
at java.lang.Runtime.loadLibrary(Runtime.java:367)
at java.lang.System.loadLibrary(System.java:988)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.<clinit>(ACRCloudExtrTool.java:56)
at com.mopo.audiofingerprinter.tageditor.ACRCloudExtrTool.createFingerprintByFile(ACRCloudExtrTool.java:0)
at com.mopo.audiofingerprinter.tageditor.ACRCloudRecognizer.recognizeByFile(ACRCloudRecognizer.java:129)
at com.mopo.audiofingerprinter.tageditor.TestActivity$RecThread.run(TestActivity.java:84)`
EDIT2
Please note that the feaures I am using libACRCloudEngine.so is working perfectly. So it's libACRCloudExtrTool.so that is the problem here.
put this line in app build.gradle,it represent the path of .so files.
android {
.
.
sourceSets {
main {
jniLibs.srcDirs = ['jniLibs']
}
}
}
I have two .aar files that I need to add to my project as dependencies. I imported the projects and did the following and it worked just fine.
dependencies {
compile project(':zoomcommonlib')
compile project(':zoomsdk')
}
However, I have added many other libraries and I had to use MultiDex library to support apps over 64K methods
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile project(':zoomcommonlib')
compile project(':zoomsdk')
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
.....
}
Yes, MultiDex is properly setup because I can build the application and run it with no problem.
The problem: When I try to utilize those specific projects, application crashes. Following Log:
18790-18790/com.mypackage.name E/UncaughtException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mypackage.name-1/base.apk", zip file "/data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mypackage.name-1/lib/arm64, /data/app/com.mypackage.name-1/base.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libzoom_stlport.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1530)
at com.zipow.cmmlib.AppContext.<clinit>(AppContext.java:31)
at com.zipow.cmmlib.AppContext.initialize(AppContext.java:64)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:225)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:184)
at com.mypackage.name.SectionListActivity.getInitializedZoomSDK(SectionListActivity.java:857)
at com.mypackage.name.SectionListActivity.access$1500(SectionListActivity.java:88)
at com.mypackage.name.SectionListActivity$8.onClick(SectionListActivity.java:812)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
18790-18899/com.mypackage.name D/FA: Logging event (FE): _ae, Bundle[{_o=crash, _sc=SectionListActivity, _si=7450316610930895524, timestamp=1488996958198, fatal=1}]
18790-18899/com.mypackage.name V/FA: Using measurement service
18790-18899/com.mypackage.name V/FA: Connecting to remote service
--------- beginning of crash
18790-18790/com.mypackage.name E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mypackage.name, PID: 18790
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.mypackage.name-1/base.apk", zip file "/data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.mypackage.name-1/lib/arm64, /data/app/com.mypackage.name-1/base.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.mypackage.name-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libzoom_stlport.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1530)
at com.zipow.cmmlib.AppContext.<clinit>(AppContext.java:31)
at com.zipow.cmmlib.AppContext.initialize(AppContext.java:64)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:225)
at us.zoom.sdk.ZoomSDK.initialize(ZoomSDK.java:184)
at com.mypackage.name.SectionListActivity.getInitializedZoomSDK(SectionListActivity.java:857)
at com.mypackage.name.SectionListActivity.access$1500(SectionListActivity.java:88)
at com.mypackage.name.SectionListActivity$8.onClick(SectionListActivity.java:812)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
From my understanding, those project dependencies are not properly getting added with MultiDex enabled. Is there some configuration that I am missing for project dependencies?
I've also tried the following in my build.gradle file.
dexOptions {
preDexLibraries = false
}
It seems to have no effect on it. It crashes each time.
The ZoomSDK you have doesn't support 64bit Android, unfortunately. In the mean time, you need to disable the use of 64bit libraries in your app and only support the mentioned framework so it builds in 32bit mode.
Add the following to the build.gradle of the main module of your app:
android {
defaultConfig {
ndk {
abiFilters "armeabi-v7a"
}
}
}
From the Zoom forum:
We support only 32 bit libs now. To work on 64 bit devices, you should
not use other 64 bit libs ( from other projects or other third party
SDK). Android OS can support 32 bit libs on 64 bit devices if you
don't have other 64 bit libs in the project
For x86, it can be supported via Intel ARM binary translator
(Houdini). But your app should not contain other x86 targeted native
binaries.
In order for the app to run on x86, all the binary files in your app should target on ARM, binary translator will translate them to
support x86.
If your app contains other binary files that target on x86, you should delete those files to remain only ARM targets. Because on x86
devices, if an app have binary files target on x86, it also should
have the file that target on ARM. Because Zoom Android SDK does not
contains any x86 binaries, so other files also can't have binaries
that target on x86 in order for the SDK to run.
The ARM binary translator works at run time, not at compile time.
You only need to add following to main gradle file
android {
defaultConfig {
ndk {
abiFilters "armeabi-v7a"
}
}
}
and in gradle.properties file add the following line
android.useDeprecatedNdk = true