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
Related
I cant solve this bug for many days. It happens only when I connect firebase realtime database.
Process: com.bae.dialogflowbot, PID: 4982
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/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/base.apk"],nativeLibraryDirectories=[/data/app/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/lib/x86, /system/lib, /system_ext/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:7244)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
**Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[**[zip file "/data/app/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/base.apk"],nativeLibraryDirectories=[/data/app/~~RkMsTUa-PZYOQLsQ7fP8Uw==/com.bae.dialogflowbot-m8QxV2lnB1WTxOUZJ-hy0w==/lib/x86, /system/lib, /system_ext/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
I tried this and it seemed to work. Go to your gradle and comment out this line:
implementation platform('com.google.firebase:firebase-bom:29.0.3')
Use this one:
implementation platform('com.google.firebase:firebase-bom:27.0.0')
I had FMS working on one project and tried to fold it back into another, but got the same error. After a bunch of unsuccessful searches, I tried making changes to each setting to mirror the first project and this one seemed to work.
In Android 9 (API 28) my App crashes when creating a new AmazonSNSClient (in API 26 I don't get any errors):
AmazonSNSClient pushClient = new AmazonSNSClient(credentialsProvider);
My LogCat says:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/logging/LogFactory;
at com.amazonaws.AmazonWebServiceClient.<clinit>(AmazonWebServiceClient.java:55)
at myapp.service.AWSMessagingService.createEndpoint(AWSMessagingService.java:170)
at myapp.service.AWSMessagingService.registerWithSNS(AWSMessagingService.java:103)
at myapp.service.PushNotificationService.sendRegistrationToAWS(PushNotificationService.java:109)
at myapp.service.PushNotificationService.onNewToken(PushNotificationService.java:105)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:86)
at com.google.firebase.iid.zzg.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" on path: DexPathList[[zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/base.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_dependencies_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_resources_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_0_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_1_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_2_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_3_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_4_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_5_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_6_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_7_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_8_apk.apk", zip file "/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/base.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_dependencies_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_resources_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_0_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_1_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_2_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_3_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_4_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_5_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_6_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_7_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_8_apk.apk!/lib/x86, /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_slice_9_apk.apk!/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.amazonaws.AmazonWebServiceClient.<clinit>(AmazonWebServiceClient.java:55)
at myapp.service.AWSMessagingService.createEndpoint(AWSMessagingService.java:170)
at myapp.service.AWSMessagingService.registerWithSNS(AWSMessagingService.java:103)
at myapp.service.PushNotificationService.sendRegistrationToAWS(PushNotificationService.java:109)
at myapp.service.PushNotificationService.onNewToken(PushNotificationService.java:105)
at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:86)
at com.google.firebase.iid.zzg.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
2018-12-17 09:25:07.483 10291-10344/myapp E/AndroidRuntime: Suppressed: java.io.IOException: No original dex files found for dex location /data/app/myapp-grqOb2dmxK1zDq9u44b9Rg==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5749)
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)
I found out that I can avoid the error if I don't exclude "commons-logging" from "com.amazonaws:aws-android-sdk-sns" in my build.gradle, so I replaced:
implementation 'com.amazonaws:aws-android-sdk-sns:2.2.0', {
exclude module: 'commons-logging'
}
with:
implementation 'com.amazonaws:aws-android-sdk-sns:2.2.0'
The app works fine now but I can't build a signed APK because I get
the error "DuplicatePlatformClasses: Duplicate Platform Classes" and
my Lint Report says:
commons-logging defines classes that conflict with classes now
provided by Android. Solutions include finding newer versions or
alternative libraries that don't have the same problem (for example,
for httpclient use HttpUrlConnection or okhttp instead), or
repackaging the library using something like jarjar. There are a
number of libraries that duplicate not just functionality of the
Android platform but using the exact same class names as the ones
provided in Android -- for example the apache http classes. This can
lead to unexpected crashes.
To solve this, you need to either find a newer version of the library
which no longer has this problem, or to repackage the library (and all
of its dependencies) using something like the jarjar tool, or finally,
rewriting the code to use different APIs (for example, for http code,
consider using HttpUrlConnection or a library like okhttp). Note: This
issue has an associated quickfix operation in Android Studio and
IntelliJ IDEA. To suppress this error, use the issue id
"DuplicatePlatformClasses" as explained in the Suppressing Warnings
and Errors section.
So I ran "gradlew app:dependencies > dependencies.txt" in the terminal in my project folder and found out that "com.amazonaws:aws-android-sdk-sns:2.2.0" uses "commons-logging:commons-logging:1.1.1" but I can also find "commons-logging:commons-logging:1.2" which is "provided by Android" I guess?
So why does "com.amazonaws:aws-android-sdk-sns:2.2.0" not use "commons-logging:commons-logging:1.2" if I exclude "commons-logging:commons-logging:1.1.1" and how can I fix this issue?
I could solve the error by updating "com.amazonaws:aws-android-sdk-sns:2.2.0" to a newer version (in my case "com.amazonaws:aws-android-sdk-sns:2.9.1").
The NoClassDefFoundError in Android 9 is also tracked in this issue:
https://github.com/aws-amplify/aws-sdk-android/issues/476
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
I am try to create a simple hello world app for android. I created a new android project, with blank activity, the first thing I see is:
Error:(1, 0) Plugin is too old, please update to a more recent
version, or set ANDROID_DAILY_OVERRIDE environment variable to
"df94d6841b68f9e80ddebea52ebc092b1d66cb93" Fix plugin version and sync projectOpen
File
This I fixed after changing gradle wrapper properties to https://services.gradle.org/distributions/gradle-2.11-all.zip (it was 2.8 earlier)
Then I changed com.android.tools.build:gradle:2.0.0-alpha2 to beta2.
Atleast the gradle sync worked, so I decided to run the project. It compiled, pushed the apk to my device, followed by this crash :
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.poketpixels.gcmfinal.MainActivity" on path: DexPathList[[zip file
"/data/app/com.poketpixels.gcmfinal-1/base.apk"],nativeLibraryDirectories=[/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 android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2259)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)
at android.app.ActivityThread.access$900(ActivityThread.java:154)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
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:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Suppressed: java.lang.ClassNotFoundException:
com.poketpixels.gcmfinal.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 not found using the
boot class loader; no stack available
Why are there gradle version conflicts just after I create a fresh
project.
Why are there app crashes too ?
First disconnect from a network before starting your android studio. After it's started you can now connect back to a network and update your sdk's.
Then take a cup of coffee.
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 ...