Who can help me fix error in my Android Project. I make sync with dropbox in my project, but when i try start app i have errors: Caused by: java.lang.UnsatisfiedLinkError: Library DropboxSync not found
09-02 12:56:55.367 1313-1313/? E/AndroidRuntime: Uncaught handler: thread main exiting due to uncaught exception
09-02 12:56:55.377 1313-1313/? E/AndroidRuntime: java.lang.ExceptionInInitializerError
at com.dropbox.sync.android.CoreAccountManager.initNativeLib(CoreAccountManager.java:111)
at com.dropbox.sync.android.CoreAccountManager.<init>(CoreAccountManager.java:91)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:132)
at com.dropbox.sync.android.DbxAccountManager.getInstance(DbxAccountManager.java:100)
at com.shvedchenko.skleroshop.MainActivity.onCreate(MainActivity.java:44)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:119)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at com.dropbox.sync.android.NativeLib.<init>(NativeLib.java:33)
at com.dropbox.sync.android.NativeLib.<clinit>(NativeLib.java:11)
... 18 more
Caused by: java.lang.UnsatisfiedLinkError: Library DropboxSync not found
at java.lang.Runtime.loadLibrary(Runtime.java:489)
at java.lang.System.loadLibrary(System.java:557)
at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:411)
... 20 more
Line №44 is mDbxAcctMgr = DbxAccountManager.getInstance(getApplicationContext(), appKey, appSecret);
I don't understand whats wrong?
Thx!
Here is my solution:
dependencies {
compile files('libs/dropbox-sync-sdk-android.jar')
}
android {
tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
pkgTask -> pkgTask.jniFolders = new HashSet<File>();
pkgTask.jniFolders.add(new File(projectDir, 'libs'));
}
}
Place the 'libs' folder from Dropbox sdk at the same level with 'build' and 'src' folder.
It looks like this is a general issue with native libraries and gradle. I found this SO answer helpful: Include .so library in apk in android studio
Part of my build.gradle file now looks like this, and my app starts successfully:
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: '*.jar')
}
task nativeLibsToJar(
type: Zip,
description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
extension 'jar'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
tasks.withType(Compile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
}
You seem to miss the library for Dropbox (native part)
you can see that on the bottom of your stacktrace
Caused by: java.lang.UnsatisfiedLinkError: Library DropboxSync not found
at java.lang.Runtime.loadLibrary(Runtime.java:489)
at java.lang.System.loadLibrary(System.java:557)
at com.dropbox.sync.android.NativeHttp.<clinit>(NativeHttp.java:411)
... 20 more
check the library download or documentation where to get the missing library file
[UPDATE]: How To use native libraries with android studio
Put your *.so files inside a libs folder beside the src folder
task copyNativeLibs(type: Copy) {
from(new File('libs')) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniDir new File(buildDir, 'native-libs')
}
solution without copying data
Probably, most of us developers don't like to copy data from one location to another... So here's the solution without copying the .so files to your project:
compile files('M:\\Dropbox\\SWDevelopment\\Libraries\\Android\\dropbox-android-sync-sdk-3.1.2\\libs\\dropbox-sync-sdk-android.jar')
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
extension 'jar'
from fileTree(dir: 'M:/Dropbox/SWDevelopment/Libraries/Android/dropbox-android-sync-sdk-3.1.2/libs', include: '**/*.so')
into 'lib/'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(nativeLibsToJar)
}
Just adjust the 2 occurences of my dropbox sync api folder to your own one ...
Related
Android app crashes in phone when build using Release Type but works fine when build using debug build type or if debugging is enabled in release mode.
Logcat error are showing verify error due to one of the abstract class
There are no proguard files in the application. i have tried by adding
'useProguard false' in build.gradle but it won't help
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 28
defaultConfig {
applicationId "com.newgen.mcap.srei"
minSdkVersion 21
targetSdkVersion 28
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
checkReleaseBuilds false
disable "ResourceType"
}
}
dependencies {
compile 'com.android.support:support-v4:23.4.0'
compile files('libs/com.antlersoft.android.db_0.1.6.jar')
compile files('libs/commons-lang3-3.1.jar')
compile files('libs/dmsapi.jar')
compile files('libs/ImgAndro.jar')
compile files('libs/NGSecurity.jar')
}
Logcat error in here:
--------- beginning of crash
2019-01-14 16:34:28.599 16678-16696/com.newgen.mcap.srei E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.newgen.mcap.srei, PID: 16678
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.VerifyError: Rejecting class com.newgen.mcap.client.custom.CustomHelper_1_1 that attempts to sub-type erroneous class com.newgen.mcap.client.util.DefaultCustomHelper (declaration of 'com.newgen.mcap.client.custom.CustomHelper_1_1' appears in /data/app/com.newgen.mcap.srei-1/base.apk)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
at com.newgen.mcap.client.util.NGCaptureSingleton.getDefaultCustomHelperForName(NGCaptureSingleton.java:109)
at com.newgen.mcap.client.util.NGCaptureSingleton.loadXMLConfiguration(NGCaptureSingleton.java:591)
at com.newgen.mcap.client.util.NGCaptureSingleton.initConfiguration(NGCaptureSingleton.java:414)
at com.newgen.mcap.client.util.NGCaptureSingleton.setAssets(NGCaptureSingleton.java:96)
at com.newgen.mcap.client.gui.SplashScreen$MastersUpdationTask.doInBackground(SplashScreen.java:145)
at com.newgen.mcap.client.gui.SplashScreen$MastersUpdationTask.doInBackground(SplashScreen.java:120)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.VerifyError: Verifier rejected class com.newgen.mcap.client.util.DefaultCustomHelper: java.lang.String[] com.newgen.mcap.client.util.DefaultCustomHelper.selectMasterData(java.lang.String, java.lang.String, java.util.LinkedHashMap, boolean) failed to verify: java.lang.String[] com.newgen.mcap.client.util.DefaultCustomHelper.selectMasterData(java.lang.String, java.lang.String, java.util.LinkedHashMap, boolean): [0xCA] returning undefined register (declaration of 'com.newgen.mcap.client.util.DefaultCustomHelper' appears in /data/app/com.newgen.mcap.srei-1/base.apk)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
at com.newgen.mcap.client.util.NGCaptureSingleton.getDefaultCustomHelperForName(NGCaptureSingleton.java:109)
at com.newgen.mcap.client.util.NGCaptureSingleton.loadXMLConfiguration(NGCaptureSingleton.java:591)
at com.newgen.mcap.client.util.NGCaptureSingleton.initConfiguration(NGCaptureSingleton.java:414)
at com.newgen.mcap.client.util.NGCaptureSingleton.setAssets(NGCaptureSingleton.java:96)
at com.newgen.mcap.client.gui.SplashScreen$MastersUpdationTask.doInBackground(SplashScreen.java:145)
at com.newgen.mcap.client.gui.SplashScreen$MastersUpdationTask.doInBackground(SplashScreen.java:120)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
My question is not a duplicate of Link
as crash is due to build type and not due to android api level. And i have tried the accepted answer by deleting the build and release folder before building apk.
It is not related to debug/release build. You should handle exception in
com.newgen.mcap.client.util.NGCaptureSingleton.getDefaultCustomHelperForName
(NGCaptureSingleton.java:109)
Steps 1: Open Android Studio Setting and go to Build, Execution, Deployment -> Gradle
Copy Gradle Service Directory Path
In my case that is C:/Users/bhanu.sharma/.gradle
Step 2: Open File Explorer and Paste the Gradle service directory Path
Add the file gradle.properties in here if it is not present
Step 3: Open Android Studio and change project type to Android, You will see
gradle.properties file here
Step 4: Add the line android.enableD8=false in gradle.properties file.
Step 5: Clean and Build the signed apk.
I got this error when we run apk file of our application. In build.gradle we set multidex and compile multidex is existed in Gradle file . We changed the version of Firebase versions to above and below but that's did not work for us . This is our full log in Run console :
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ir.parsinteam.ojoobe, PID: 5141
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)
at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101)
at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40)
at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45)
at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390)
at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148)
at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134)
at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110)
at ir.adad.client.Adad.initialize(Adad.java:22)
at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/ir.parsinteam.ojoobe-2/base.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_dependencies_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_0_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_1_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_2_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_3_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_4_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_5_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_6_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_7_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_8_apk.apk", zip file "/data/app/ir.parsinteam.ojoobe-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/ir.parsinteam.ojoobe-2/lib/x86, /data/app/ir.parsinteam.ojoobe-2/base.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_dependencies_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_0_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_1_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_2_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_3_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_4_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_5_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_6_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_7_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_8_apk.apk!/lib/x86, /data/app/ir.parsinteam.ojoobe-2/split_lib_slice_9_apk.apk!/lib/x86, /system/lib, /vendor/lib]]
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 com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)
at ir.adad.client.LocationMethods.callAndroidLocationService(LocationMethods.java:101)
at ir.adad.client.LocationMethods.<init>(LocationMethods.java:40)
at ir.adad.client.LocationMethods.getInstance(LocationMethods.java:45)
at ir.adad.client.AdadScript.urlParameters(AdadScript.java:390)
at ir.adad.client.AdadScript.downloadClient(AdadScript.java:148)
at ir.adad.client.AdadScript.initializeInternal(AdadScript.java:134)
at ir.adad.client.AdadScript.initializeClient(AdadScript.java:110)
at ir.adad.client.Adad.initialize(Adad.java:22)
at ir.parsinteam.ojoobe.activities.MainActivity.onCreate(MainActivity.java:62)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
Application terminated.
In your build.gradle, upgrade play-services-gcm and play-services-location to 15.0.1:
com.google.android.gms:play-services-gcm:15.0.1
com.google.android.gms:play-services-location:15.0.1
This is happen when we try to authenticate user with some authenticate service like AccountKit FirebaseAuth and those service depends on play-services-auth So, Add
implementation 'com.google.android.gms:play-services-auth:16.0.0'
on your build.gradle dependencies
I fixed this issue. Please follow below code.
Added following to android/build.gradle
allprojects {
repositories {
//start here
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.google.android.gms') {
details.useVersion '12.0.1'
}
if (requested.group == 'com.google.firebase') {
details.useVersion '12.0.1'
}
}
}
//end
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Well, I am using Account Kit from Facebook. After I adding play-services-auth problem is resolved.
implementation 'com.facebook.android:account-kit-sdk:4.39.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
I was using a react native package
react-native-facebook-account-kit
resolved by adding
implementation 'com.google.android.gms:play-services-auth:16.0.1'
For me i tried adding implementation 'com.google.android.gms:play-services-auth:18.0.0'
didnot work for me..
But after adding the below dependency it worked for me.
implementation 'com.android.support:multidex:1.0.3'
I was having this issue when i enabled proguard, when i'm disabling it I don't get the crash. I fixed it by adding following dependencies in my app level gradle. I have used FCM, Firebase Analytics and google location in my app. So I had to add the following, if u r not using anything then skip it.
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.firebase:firebase-analytics:17.4.3'
Also add the following in your proguard rules file.
-dontshrink
-dontoptimize
-dontwarn
-dontpreverify
I know this question may be duplicate but I have tried many solutions but I am unable to make my app work. It should be noted that I have enabled Multidex but still getting below error. I am creating a react native app.
FATAL EXCEPTION: main
Process: com.xxxxxx.yyyyyyyy, PID: 3978
java.lang.NoClassDefFoundError: com.google.android.gms.common.internal.zzbo
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5049)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
at android.app.ActivityThread.access$1500(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
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:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
If you are developing a react native application and above error came , just make sure that all of your dependencies's Gradle are using same version of firebase servces and play service base.
For example :- my app level gradle file contains
compile "com.google.android.gms:play-services-base:11.4.0"
compile "com.google.firebase:firebase-core:11.4.0"
compile "com.google.firebase:firebase-messaging:11.4.0"
compile "com.google.firebase:firebase-analytics:11.4.0"
compile "com.google.firebase:firebase-crash:11.4.0"
compile "com.google.firebase:firebase-ads:11.4.0"
and one react-native library is using
compile "com.google.android.gms:play-services-base:11.8.0"
and other one library is using
compile "com.google.android.gms:play-services-base:+"
so what i did , i changed all services version to 11.8.0.
BTW you can see gradles of all libraries or dependencies when you open your react-native-project/android folder in Android studio
I hope this will solve your issue
After moving my project to another computer, when trying to run the code (The exact same working code from the first computer), the application crashes.
This is the error in the console:
05-28 21:33:35.502 5021-5021/com.dean.booktown E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.dean.booktown, PID: 5021
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.dean.booktown-1/base.apk", zip file "/data/app/com.dean.booktown-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.dean.booktown-1/split_lib_slice_4_apk.apk"],nativeLibraryDirectories=[/data/app/com.dean.booktown-1/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5244)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4836)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4776)
at android.app.ActivityThread.access$1600(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5525)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.dean.booktown-1/base.apk", zip file "/data/app/com.dean.booktown-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.dean.booktown-1/split_lib_slice_4_apk.apk"],nativeLibraryDirectories=[/data/app/com.dean.booktown-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.ActivityThread.installProvider(ActivityThread.java:5229)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4836)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4776)
at android.app.ActivityThread.access$1600(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5525)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Suppressed: java.lang.ClassNotFoundException: com.google.firebase.provider.FirebaseInitProvider
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 searched for other people with the same problem, and most answers were about not compiling play-services as a whole but only the parts needed, but I already had it that way
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0" /* TODO: Check 25.0.3 */
/* Before update - 24.0.2 */
defaultConfig {
applicationId "com.dean.booktown"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "Beta v0.8.6 'Ready'"
/* To enable Jack Toolchain - required for Java 8 */
/* jackOptions {
enabled true
} */
}
/* To enable Java 8 */
/* compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
} */
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0' /* Error? TODO: Check 25.3.1 */
compile 'com.google.android.gms:play-services-ads:10.2.6' /* AdMob */
compile 'com.github.bumptech.glide:glide:4.0.0-RC0' /* Glide - Loads lightweight images */
compile 'com.android.support:support-v4:23.4.0' /* TODO: Check 25.3.1 */
compile 'com.google.android.gms:play-services-location:10.2.6' /* Required for Firebase, AdMob(?) */
compile 'com.google.firebase:firebase-core:10.2.6' /* Firebase */
compile 'com.google.firebase:firebase-auth:10.2.6' /* Firebase - authentication */
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.0.2' /* The new android ConstraintLayout */
compile 'com.google.firebase:firebase-messaging:10.2.6' /* Firebase - Cloud Messaging */
compile 'com.firebase:firebase-jobdispatcher:0.5.2' /* Firebase - Cloud Messaging Job Dispatcher */
}
apply plugin: 'com.google.gms.google-services'
Maybe the problem is here: My package name is com.dean.booktown
not com.dean.booktown-1
if that really is the problem, where do I find the mistake to fix it, and why did it happen in the first place?
Thank you very much,
Dean
com.dean.booktown-1
This is actually the folder where your APK is installed
Is the SDK and Google tools and libraries installed ? You should double check that since you swapped environment.
Edit;
From this question, is MultiDex enabled ?
MultiDex makes libraries with a lot of classes available to your app. To add it, see answer #2
After long fight with building project i stuck on launching android activity
logcat output:
I/Unity (20479): Welcome on Android border
I/Unity (20479): AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/testapp/androidplugin/app/SplashScreen;
I/Unity (20479): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/testapp/androidplugin/app/SplashScreen;
I/Unity (20479): at com.testapp.androidplugin.app.UnityBinder.foo(UnityBinder.java:16)
I/Unity (20479): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
I/Unity (20479): at com.unity3d.player.UnityPlayer.a(Unknown Source)
I/Unity (20479): at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
I/Unity (20479): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.testapp.androidplugin.app.SplashScreen" on path: DexPathList[[zip file "/mnt/asec/com.testapp.androidplugin.app-2/base.apk"],nativeLibraryDirectories=[/mnt/asec/com.testapp.androidplugin.app-2/lib/arm, /system/lib, /vendor/lib, sy
stem/vendor/lib, system/vendor/lib/egl, system/lib/hw]]
I/Unity (20479): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
I/Unity (20479): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
I/Unity (20479): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
First line is from Java class, so something happen...
UnityBinder.class
public static void foo(Activity activity) {
Log.i("Unity", "Welcome on Android border");
Intent myIntent = new Intent(activity, SplashScreen.class);
activity.startActivity(myIntent);
}
both classes are in the same package, I event tried with providing full path to package, but same result
if (GUI.Button(new Rect(200, 200, 400, 400), "Start"))
{
var androidJC = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
var jo = androidJC.GetStatic<AndroidJavaObject>("currentActivity");
var jc = new AndroidJavaClass("com.testapp.androidplugin.app.UnityBinder");
jc.CallStatic("foo", jo);
}
SplashScreen is extended by AppCompatActivity
I used Java decompiler to look at files structure, and SplashScreen class exists there
In Plugins -> Android directory I have appcompat-v7-23.1.1.aar, design-23.1.1.aar, classes (which is from my unpacked *.aar android module), rest and assets folder.
I'm using unity 5.3
I have managed to do it. I copied appcompat-v7-25.3.1.aar & support-v4-25.3.1.aar to my Assets folder but it didn't work. Then I switched to Gradle build system in Unity and added following lines under dependencies.
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
It should like this
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
**DEPS**}