I'm using this Tutorial but after run app crash app and give me this error.
Error:
FATAL EXCEPTION: IntentService[]
Process: package-name, PID: 11869
java.lang.IncompatibleClassChangeError: The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct (declaration of 'com.google.android.gms.iid.zzd' appears in /data/data/yadbegir.jfa.mansoor.com.yadbegir/files/instant-run/dex/slice-realm-optional-api_82aa9dab5d973e04cc1850ef40d4e3808a75f9c1-classes.dex)
at com.google.android.gms.iid.zzd.zzdL(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.zzd.<init>(Unknown Source)
at com.google.android.gms.iid.InstanceID.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.getInstance(Unknown Source)
at package-name.service.GCMRegistrationIntentService.registerGCM(GCMRegistrationIntentService.java:33)
at package-name.service.GCMRegistrationIntentService.onHandleIntent(GCMRegistrationIntentService.java:25)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
Try to update Google Play Services library to version 9.0.2
The Google Play services version 9.0.1 release is now available. This release fixes the following issues with the version 9.0.0 release:
Fixes a class change compilation error with ContextCompat.getNoBackupFilesDir().
Fixes a known issue with serving Admob ads on devices without the Google Play services APK when your app uses ProGuard post-processing.
Related
So, I've had my app published for nearly a year without seeing this issue, and now it shows up.
Even right now, I don't have this issue with the debug version on my phone. I don't have any issues with any emulators opened from Android Studio. However nearly every emulator from the pre-launch reports in the Google Developer Console crashes with this NoSuchMethodError upon receiving Retrofit response.
FATAL EXCEPTION: ControllerMessenger
Process: xxxxxxx, PID: 25090
java.lang.NoSuchMethodError: No direct method <init>(Lcom/google/gson/Gson;)V in class Lcom/google/gson/Gson$1; or its super classes (declaration of 'com.google.gson.Gson$1' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
at com.google.gson.Gson.doubleAdapter(Gson.java:278)
at com.google.gson.Gson.<init>(Gson.java:217)
at com.google.gson.Gson.<init>(Gson.java:174)
at retrofit2.converter.gson.GsonConverterFactory.create(GsonConverterFactory.java:42)
at xxxxxxx.MtbActivity.loadJSON(MtbActivity.java:149)
at xxxxxxx.MtbActivity.onCreate(MtbActivity.java:135)
at android.app.Activity.performCreate(Activity.java:6013)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2359)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2466)
at android.app.ActivityThread.access$1200(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1341)
at android.os.Handler.dispatchMessage(Handler.java:102)
at androidx.test.espresso.base.Interrogator.a(Interrogator.java:19)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:142)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:134)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:114)
at androidx.test.espresso.action.Tap$1.b(Tap.java:6)
at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:22)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:9)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:78)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:94)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:3)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
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:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
What I have tried:
Updated Retrofit and Gson dependencies to latest.
Invalidate caches and restarted
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
Thanks to Peter here
To summarize:
The existing crawler is FUBAR. As a workaround you can go back to the previous version of the crawler by opting out of the newly released one.
Here's how to opt-out:
Sign in to your Play Console.
Select an app.
Select Release management > Pre-launch report > Settings. In the “Pre-launch report version” section, move the Opt-out switch to the right until it turns blue.
After this, the launch reports appear correctly again.
Error when testing new versions of Google Fit Samples,
Process: com.google.android.gms.fit.samples.basicrecordingapi, PID: 22949
java.lang.NullPointerException: Attempt to invoke virtual method 'android.accounts.Account com.google.android.gms.auth.api.signin.GoogleSignInAccount.getAccount()' on a null object reference
at com.google.android.gms.common.api.GoogleApi.zzagd(Unknown Source)
at com.google.android.gms.common.api.GoogleApi.zza(Unknown Source)
at com.google.android.gms.common.api.internal.zzbr.<init>(Unknown Source)
at com.google.android.gms.common.api.internal.zzbp.zzb(Unknown Source)
at com.google.android.gms.common.api.internal.zzbp.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:158)
at android.os.HandlerThread.run(HandlerThread.java:61)
the methods have changed and I have noticed that since then, my application that uses the old methods does not register the data for DataTypes TYPE_ACTIVITY_SEGMENT, TYPE_STEP_COUNT_DELTA and sometimes TYPE_HEART_RATE_BPM. What is the solution?
I need both Firebase Cloud Messaging and Nearby support in my app.
The latest allowed Nearby version is 9.0.0. So, I have to use following dependencies:
//Firebase
compile ‘com.google.firebase:firebase-core:9.0.0'
compile ‘com.google.firebase:firebase-messaging:9.0.0'
//Nearby
compile ‘com.google.android.gms:play-services-nearby::9.0.0’
It compiles successfully but when I try to get Firebase instance app crashes with IllegalAccessError:
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:114)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.obolus.poc.customer-1/base.apk)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
Using of different versions for these components causes compile error. Firebase 10.0.1 without Nearby works fine but I need both.
How can I solve this issue?
Thanks.
Solution
Perhaps it's a bug but for now to ensure that play-services plugin will check available versions correctly place line
apply plugin: 'com.google.gms.google-services'
at the bottom of your build.gradle file (below the dependencies block).
Check out https://firebase.google.com/docs/android/setup#add_the_sdk
I think you are wrong the latest nearby is v10 the same as Firebase
use the following dependencies that are here under
com.google.android.gms:play-services-nearby:10.0.1
com.google.firebase:firebase-core:10.0.1
com.google.firebase:firebase-messaging:10.0.1
Recently I added Firebase to Unity project. Project is built perfectly but when I run project on Android device it crashes and exception is :
java.lang.NoSuchMethodError: no method with name='getCodeCacheDir'
signature='()Ljava/io/File;' in class Landroid/app/Activity; at
java.lang.Runtime.nativeLoad(Native Method) at
java.lang.Runtime.doLoad(Runtime.java:421) at
java.lang.Runtime.load(Runtime.java:331) at
java.lang.System.load(System.java:565) at
com.unity3d.player.UnityPlayer.nativeRender(Native Method) at
com.unity3d.player.UnityPlayer.nativeRender(Native Method) at
com.unity3d.player.UnityPlayer.a(Unknown Source) at
com.unity3d.player.UnityPlayer$b$1.handleMessage(Unknown Source) at
android.os.Handler.dispatchMessage(Handler.java:98) at
android.os.Looper.loop(Looper.java:136) at
com.unity3d.player.UnityPlayer$b.run(Unknown Source)`
This line says it all:
java.lang.NoSuchMethodError: no method with name='getCodeCacheDir'
It is very likely that Google Play Services is not updated. You have to update it to the latest Google Play Services and this problem should go away.
It happens when SupportMapFragment is used, specifically when transaction commited. It started to happen recently on specific device (maybe after update of google play services, couldn't trace it).
Crashes are consistent through all previous app version that was already tested and there was no changes in used libs versions or build tools.
Environment details:
Device LG G3 D855
Google play services lib version 8.4.0
Google play services on device version 9.6.83
Android version 5.0
Build tools version "23.0.2"
Crash stack trace:
E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NullPointerException: Attempt to get length of null array
at maps.G.a.a(Unknown Source)
at maps.V.N.a(Unknown Source)
at maps.D.e.a(Unknown Source)
at maps.D.p.a(Unknown Source)
at maps.ad.ae.a(Unknown Source)
at maps.ad.t.a(Unknown Source)
at maps.ad.M.a(Unknown Source)
at ul.onTransact(:com.google.android.gms.DynamiteModulesB:107)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown Source)
at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreateView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5274)
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:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Has anyone else witnessed this? If so, were you able to solve it?
In addition to the info provided in the link, I'm using the MultiDex library which I know sometimes causes weird behaviors.
Due to NDA cannot provide any application specific information.
<activity android:name="com.bison.activities.YourActivity"
android:hardwareAccelerated="true"
>
<intent-filter>
<action
android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
Try adding this to you activity in manifest.
If it helps study the hardware acceleration in google documentation