Unable to load firebase Init provider - android studio - java

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.

Related

How to avoid appcrashes in Android 9 with AmazonSNSClient?

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

Android Google Places API on Lollipop and below

Does Google Places API work on Android Lollipop and below?
Because some phones with my app that uses Google Places gave this error:
java.lang.ClassNotFoundException:
com.google.android.gms.location.places.Places
java.lang.Class.classForName(Native Method)
java.lang.Class.forName()Class.java:324
md5b74118df040d8158864d95fd3b66e81d.MainActivity.n_onResume(Native Method)
md5b74118df040d8158864d95fd3b66e81d.MainActivity.onResume()MainActivity.java:52
android.app.Instrumentation.callActivityOnResume()Instrumentation.java:1281
android.app.Activity.performResume()Activity.java:6320
android.app.ActivityThread.performResumeActivity()ActivityThread.java:3110
android.app.ActivityThread.handleResumeActivity()ActivityThread.java:3152
android.app.ActivityThread.handleLaunchActivity()ActivityThread.java:2495
at android.app.ActivityThread.-wrap11(ActivityThread.java)
android.app.ActivityThread$H.handleMessage()ActivityThread.java:1354
android.os.Handler.dispatchMessage()Handler.java:102
android.os.Looper.loop()Looper.java:148
android.app.ActivityThread.main()ActivityThread.java:5443
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:728
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:618
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.location.places.Places" on path: DexPathList[[zip file "/mnt/expand/e7a5152a-8805-4bc2-8125-c715c5d4ff20/app/torathamachane.torathamachane-2/base.apk"],nativeLibraryDirectories=[/mnt/expand/e7a5152a-8805-4bc2-8125-c715c5d4ff20/app/torathamachane.torathamachane-2/lib/arm, /mnt/expand/e7a5152a-8805-4bc2-8125-c715c5d4ff20/app/torathamachane.torathamachane-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
One Reason of your problem can be 'You upgraded your google play service version in your dependency'
In 9.0.2, the 'places' library was inside 'location' library. In 9.2.0, you need to add 'places' library as dependency:
compile 'com.google.android.gms:play-services-places:9.2.0'
Also,for play service 9.2.0 places import has changed from
import com.google.android.gms.location.places;
to
import com.google.android.gms.location.places.Place;
or you need all places folder
import com.google.android.gms.location.places.*;

Android Studio Errors moments after new project creation

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.

Error - Didn't find class "javax.naming.ldap.LdapName"

I'm using unirest to get a camfind result.
The full error log :
04-14 18:24:39.574 1880-2300/projectco.project E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-120
Process: projectco.project, PID: 1880
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/ldap/LdapName;
at com.mashape.relocation.conn.ssl.AbstractVerifier.extractCNs(AbstractVerifier.java:277)
at com.mashape.relocation.conn.ssl.AbstractVerifier.getCNs(AbstractVerifier.java:265)
at com.mashape.relocation.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:157)
at com.mashape.relocation.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:140)
[...] more "at"s
at bookshotco.bookshot2.MainActivity$1.run(MainActivity.java:100)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.naming.ldap.LdapName" on path: DexPathList[[zip file "/data/app/projectco.project-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[..]
Suppressed: java.lang.ClassNotFoundException: javax.naming.ldap.LdapName
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)
... 23 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
Few people had this problem and even fewer solved it, most of the times using stuff to do with compatibility of different versions which did not work for me.
The emulator I'm using is up to date (nexus 5 on api 21).
I've recently had the same issue and it was only happening in obfuscated code. So keeping the whole org.apache package in Proguard rules solved the issue.
# Keep Apache Package, since it cannot find some of the classes and throws Verify Error
-keep class org.apache.** {*;}
This error can also be caused by requiring ssl (i.e., "useSSL") when connecting to a remote server and NOT having verifyServerCertificate and trustServerCertificate defined as below, and also not having a server certificate defined properly. The system is trying to use an LDAP authentication process, thus the error.
val info = Properties()
info.setProperty("useSSL", "true")
info.setProperty("requireSSL", "true")
info.setProperty("user", user)
info.setProperty("password", password)
info.setProperty("verifyServerCertificate", "false")
info.setProperty("trustServerCertificate", "true")
Also, if you define:
trustServerCertificate=false
then you may need to set the following (unless everything matches up):
disableSslHostnameVerification=true

using card view and recyclerView in eclipse

I'm trying to use the new android component (cardView and recyclerView). but I work with eclipse and I try with a different way but it's not work for me.how should i do ?
Error:
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.RecyclerView" on path: DexPathList[[zip file "/data/app/com.test.cardviewexemple-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.test.cardviewexemple-1, /vendor/lib, /system/lib]].

Categories