Could not find class 'com.google.firebase.FirebaseOptions' - android

I have a working app and everything was working well, but when I updated it with MoPub app and generated a new signed APK and uploaded it to the play store some users reported a crash while it works well on other users' devices.
I tested the app a lot on different devices and finally found a device that it crashed on.
I debugged the app and found this error code in the android monitor
06-18 16:17:51.665 17951-17951/akhbar4all.com.akhbar4all W/dalvikvm:
VFY: unable to find class referenced in signature
(Lcom/google/firebase/auth/FirebaseUser;) 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all E/dalvikvm: Could not find class
'com.google.firebase.FirebaseApp$zza', referenced from method
com.google.firebase.FirebaseApp.zza 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all W/dalvikvm: VFY: unable to
resolve check-cast 9003 (Lcom/google/firebase/FirebaseApp$zza;) in
Lcom/google/firebase/FirebaseApp; 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all D/dalvikvm: VFY: replacing
opcode 0x1f at 0x0019 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all D/dalvikvm: DexOpt: unable to
opt direct call 0xec65 at 0x0b in
Lcom/google/firebase/FirebaseApp;.getToken 06-18 16:17:51.665
17951-17951/akhbar4all.com.akhbar4all D/AndroidRuntime: Shutting down
VM 06-18 16:17:51.665 17951-17951/akhbar4all.com.akhbar4all
W/dalvikvm: threadid=1: thread exiting with uncaught exception
(group=0x41bdc700) 06-18 16:17:51.685
17951-17951/akhbar4all.com.akhbar4all E/AndroidRuntime: FATAL
EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown
Source)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1214)
at
android.content.ContentProvider.attachInfo(ContentProvider.java:1189)
at
com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown
Source)
at
android.app.ActivityThread.installProvider(ActivityThread.java:5119)
at
android.app.ActivityThread.installContentProviders(ActivityThread.java:4725)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4665)
at android.app.ActivityThread.access$1400(ActivityThread.java:159)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
But I was shocked because I didn't use any Firebase api so why is this happening and what is the solution? I'd be happy for any help from someone.

I resolved the problem.
The problem was that their is an error in firebase including latest google play services 9.0.2
So i choose only the google play services that i need and not the whole services excluding (firebase) and everything works well
To setup google services by what you need and don't include the whole services visit this link

Thanks, I had also compiled the multidex class to solve my problem but it made my application a little heavier, now it is better optimized!
This is to compile only the google services that you are going to use and not all with the compile statement 'com.google.android.gms: play-services: 9.0.0'
Now my gradle file looks like this
//compile 'com.android.support:multidex:1.0.0'
//compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'

Related

java.lang.NoClassDefFoundError: com.google.android.gms.internal.zzmp

Receiving this error on Android 4.4 device when starting my app. App immediately crashes. However I don't have this error on Android 5.1 device. Any clue?
10-15 22:35:06.306 14072-14072/com D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0000
10-15 22:35:06.306 14072-14072/com D/AndroidRuntime﹕ Shutting down VM
10-15 22:35:06.306 14072-14072/com W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x4304b160)
10-15 22:35:06.306 14072-14072/com E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process:com., PID: 14072
java.lang.NoClassDefFoundError: com.google.android.gms.internal.zzmp
at com.google.android.gms.measurement.internal.zzz.zzj(Unknown Source)
at com.google.android.gms.measurement.internal.zzv.(Unknown Source)
at com.google.android.gms.measurement.internal.zzz.zzAq(Unknown Source)
at com.google.android.gms.measurement.internal.zzv.zzaL(Unknown Source)
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at android.app.ActivityThread.installProvider(ActivityThread.java:4830)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4425)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4365)
at android.app.ActivityThread.access$1500(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5061)
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:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:603)
at dalvik.system.NativeStart.main(Native Method)
needed to add this in class that extends Application:
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
EDIT: I noticed this answer is becoming more popular so please note my comment on the question:
"ATTENTION To anybody reading this though! The real problem was that I was using the ENTIRE google play services framework which was forcing me into multi dex. Avoid multi dex if you can because it slows down builds. Only bring in what you need from google play services. So instead of putting "compile 'com.google.android.gms:play-services:8.1.0'", put "compile 'com.google.android.gms:play-services-location:8.1.0'" for example."
For those who have already activated MultiDex and still get this exception, it's just a stupid Android Studio / Gradle issue.
Try cleaning project, toggling Instant Run in settings, and rebuilding the project.
I had the error and i resolved it by updating the gms play-service to the latest version.

Application crashes in onCreate due to newrelic exception

I've created an Android app using Android Studio beta 0.8.2 and all was going well until the last few days when i started getting this exception just as i run it:
07-24 14:50:11.044 1176-1176/com.vme.vme I/Crashlytics﹕ Initializing Crashlytics 1.1.11.10
07-24 14:50:11.764 2325-2325/system_process D/MobileDataStateTracker﹕ default: Broadcast received: android.intent.action.ANY_DATA_STATE apnType=default
07-24 14:50:11.769 2325-2325/system_process D/MobileDataStateTracker﹕ default: Received state=CONNECTED, old=CONNECTED, reason=(unspecified)
07-24 14:50:15.079 1176-1176/com.vme.vme W/Crashlytics﹕ Crashlytics initialization was not completed in the allotted time.
07-24 14:50:15.104 1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.instrumentation.Instrumentation.openConnection, referenced from method com.vme.vme.model.network.httpClient.BasicRequestHandler.openConnection
07-24 14:50:15.104 1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30466: Lcom/newrelic/agent/android/instrumentation/Instrumentation;.openConnection (Ljava/net/URLConnection;)Ljava/net/URLConnection;
07-24 14:50:15.104 1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0009
07-24 14:50:15.114 1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.background.ApplicationStateMonitor.getInstance, referenced from method com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStart
07-24 14:50:15.114 1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30464: Lcom/newrelic/agent/android/background/ApplicationStateMonitor;.getInstance ()Lcom/newrelic/agent/android/background/ApplicationStateMonitor;
07-24 14:50:15.114 1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0000
07-24 14:50:15.114 1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.background.ApplicationStateMonitor.getInstance, referenced from method com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStop
07-24 14:50:15.114 1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30464: Lcom/newrelic/agent/android/background/ApplicationStateMonitor;.getInstance ()Lcom/newrelic/agent/android/background/ApplicationStateMonitor;
07-24 14:50:15.114 1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0003
07-24 14:50:15.309 1176-1176/com.vme.vme D/AndroidRuntime﹕ Shutting down VM
07-24 14:50:15.309 1176-1176/com.vme.vme W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41797c80)
07-24 14:50:15.429 1176-1176/com.vme.vme E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.vme.vme, PID: 1176
java.lang.NoClassDefFoundError: com.newrelic.agent.android.background.ApplicationStateMonitor
at com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStart(VMEBaseActivity.java)
I never used newrelic in this project, i've searched "newrelic" and can't find it in the whole project.
Things i can share also:
I have 2 instance of the studio running all the time, in the other project **i am using newrelic - version 2.426.0 **
it's happened on Galaxy S3 and Note 2.
Cleaning, rebuilding, closing the studio, uninstalling and reinstalling are fixing the issue. BUT IT COME BACK EVERY ONCE A DAY :(
Please help...
Build your New Relic enabled project
Run gradle --stop from the terminal/command line
Open your non-NR enabled app and clean & rebuild
Run the app
If you still get messages about New Relic in your non-NR app, you can go to the ~/.gradle/caches and remove it. Then try the above steps again.
Newer versions of gradle utilize a daemon which caches New Relic instrumentation. So this will stop the daemon and allow the app to build.
You will also want to upgrade to the latest version of New Relic. 2.426.0 is many versions behind. Go here: http://docs.newrelic.com/docs/releases/android
The thing that fixed for me was upgrading to the newest gradle version 2.1 and android plugin version to 0.13.3 from right click project folder -> module settings
If you still get messages about New Relic in your non-NR app, you can go to the project directory and remove .gradle directory and re-build project.

Could not find class 'com.google.android.gms.ads.AdView

I'm using Android Studio. I have added the googleAdMobAdsdk6-4-1.jar to the project in my previously added libs folder. I can expand the library file and actually navigate to the AdView class. It compiles with no problem but when I run it It crashes. Any assistance appreciated.
12-15 21:35:40.581 5375-5375/? E/dalvikvm﹕ Could not find class 'com.google.android.gms.ads.AdView', referenced from method net.kritico.todolist.ToDoListActivity.onCreate
12-15 21:35:40.581 5375-5375/? W/dalvikvm﹕ VFY: unable to resolve new-instance 996 (Lcom/google/android/gms/ads/AdView;) in Lnet/kritico/todolist/ToDoListActivity;
12-15 21:35:40.581 5375-5375/? D/dalvikvm﹕ VFY: replacing opcode 0x22 at 0x0037
12-15 21:35:40.585 5375-5375/? D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2034 at 0x39 in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.585 5375-5375/? I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x0b0b at 0x47 in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.585 5375-5375/? D/dalvikvm﹕ DexOpt: unable to opt direct call 0x2031 at 0x5c in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.597 5375-5375/? I/dalvikvm﹕ DexOpt: unable to optimize static field ref 0x0b0a at 0x5f in Lnet/kritico/todolist/ToDoListActivity;.onCreate
12-15 21:35:40.765 5375-5375/? D/AndroidRuntime﹕ Shutting down VM
12-15 21:35:40.765 5375-5375/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa617b908)
12-15 21:35:40.789 5375-5375/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.kritico.todolist/net.kritico.todolist.ToDoListActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
Your XML references com.google.android.gms.ads.AdView (see stacktrace) which is contained in the Google Play Services library and is how Admob is now packaged.
But your have included Admob-6.4.1 whcih is the old Admob SDK and the Admob classes there are in a different package and have slightly different signatures.
Remove Admob-6.4.1 from your project and use Google play Services instead.
See https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals#play
Remove the jar from your libs folder (That sdk is now deprecated). You should use Google play services.
After removing the jar. Clean your project and add the following under dependencies in your app level build.gradle.
compile 'com.google.android.gms:play-services-ads:8.4.0'
Sync your project as prompted after which you should be good to go.
Use this latest library:
implementation 'com.google.android.gms:play-services-ads:19.3.0'
And feel free to read the admob documentation.
I'm using react-native-admob-next and seriously I face lot of problems in implementaion
i do just :-
npm i react-native-admob-next
then open node_modules then find react-native-admob-next/android/build.gradle i
change dependencies below is code : -
just add some lines
dependencies {
//noinspection GradleDynamicVersion
// implementation 'com.intellij:annotations:+#jar'
// implementation 'com.google.android.gms:play-services-ads:20.2.0'
implementation 'com.facebook.react:react-native:+'
implementation('com.google.android.gms:play-services-ads:+')
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.ads.mediation:facebook:+'
}

Cannot deploy my apps since updating SDK tools today [duplicate]

This question already has answers here:
Libraries do not get added to APK anymore after upgrade to ADT 22
(7 answers)
Closed 9 years ago.
This morning I updated various SDK components from Eclipse. I think it was
- Android SDK or Platform tools
- Google APIs 17 update
- Android Support Library
- Google Play Services
Now, my apps won't deploy. They build ok (eventually, after an hour of reconfiguring and rebuilding) but now when I deploy to the device, I get the following:
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
Unable to resolve superclass of Lcom/com/myapp/MainActivity; (81)
Link of class 'Lcom/com/myapp/MainActivity;' failed
VFY: replacing opcode 0x71 at 0x0006
VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
Unable to resolve superclass of Lcom/com/myapp/MainActivity; (81)
Link of class 'Lcom/com/myapp/MainActivity;' failed
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x40015560)
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.MainActivity}: java.lang.ClassNotFoundException: com.myapp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.myapp.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1680)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
at android.app.ActivityThread.access$1500(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.myapp.MainActivity in loader dalvik.system.PathClassLoader[/data/app/myapp.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1672)
... 11 more
Bear in mind that this project, and others, have been happily running for months, so this isn't just some daft error like the activity missing from the manifest file.
I'm really wishing I hadn't bothered with the update now... any ideas welcome!
I faced this issue couple of days before.
Right click your project, Go to properties->Java Build path->Order and Export
Check Android Private Library->Click Ok
Clean the project and run it.it will work.
sdk\extras\android\support\v4 inside there is a jar file android-support-v4.jar add this to the external jars

Dalvik mess with library code and project cannot runs anymore

After updating ADT and Android SDK on my machine, all my projects get errors.
Now I have this:
PS: This error happens when running the project that have a jar as dependency (it was compiled with proguard and we dont have the original sourcecode to compile it again).
W/dalvikvm(3497): VFY: unable to resolve static field 994 (storeicon) in Lcom/ww/dgs/R$drawable;
D/dalvikvm(3497): VFY: replacing opcode 0x60 at 0x0042
W/dalvikvm(3497): VFY: unable to resolve static field 987 (libraryicon) in Lcom/ww/dgs/R$drawable;
D/dalvikvm(3497): VFY: replacing opcode 0x60 at 0x0060
W/dalvikvm(3497): VFY: unable to resolve static field 1069 (mainframe) in Lcom/ww/dgs/R$layout;
D/dalvikvm(3497): VFY: replacing opcode 0x60 at 0x00b1
I/dalvikvm(3497): DexOpt: unable to optimize static field ref 0x0467 at 0x16 in Lcom/ww/sharedlibrary/e;.a
D/AndroidRuntime(3497): Shutting down VM
W/dalvikvm(3497): threadid=1: thread exiting with uncaught exception (group=0x400f8760)
E/AndroidRuntime(3497): FATAL EXCEPTION: main
E/AndroidRuntime(3497): java.lang.NoClassDefFoundError: com.ww.dgs.R$layout
E/AndroidRuntime(3497): at com.ww.mainframe.MainFrame.onCreate(Unknown Source)
E/AndroidRuntime(3497): at com.ww.iba.DigiMag.onCreate(DigiMag.java:27)
E/AndroidRuntime(3497): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
E/AndroidRuntime(3497): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
E/AndroidRuntime(3497): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
E/AndroidRuntime(3497): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
E/AndroidRuntime(3497): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
E/AndroidRuntime(3497): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(3497): at android.os.Looper.loop(Looper.java:132)
E/AndroidRuntime(3497): at android.app.ActivityThread.main(ActivityThread.java:4028)
E/AndroidRuntime(3497): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(3497): at java.lang.reflect.Method.invoke(Method.java:491)
E/AndroidRuntime(3497): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
E/AndroidRuntime(3497): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime(3497): at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(3497): threadid=4: reacting to signal 3
I/dalvikvm(3497): Wrote stack traces to '/data/anr/traces.txt'
The code from com.ww is inside a jar that I used on the other builds.
I am getting this too now and am able to get around it by removing all external jars from the project. You can add them back in after it's been cleaned. I'm assuming you have access to the original project source code...
Rightclick on project, go to Java Build Path, and remove all external jars other than your Android libs. Then clean.
Got this error after updating to the Android Platform Tools preview 15 rc5 and Android Tools 21 rc5, plus running the "check for updates..." in eclipse.
LogCat error
java.lang.NoClassDefFoundError: com.someapplicationlibrary.lib.R$layout
Eclipse compiler error:
Errors occurred during the build.
Errors running builder 'Android Pre Compiler' on project 'myApplication'.
String index out of range: -51
Errors running builder 'Android Pre Compiler' on project 'someapplicationlibrary'.
String index out of range: -54
Tried to revert to the stabel Android Tools... but ending up with even more errors.
My solution was to load the workspace in a eclipse version that was not updated with the "check for updates..." in the eclipse Help menu.
Then it compiled correct, and the application worked again, hope this helps:)

Categories

Resources