java.lang.RuntimeException: Unable to destroy activity {com.xxxxx/com.xxxxx.MapsActivity}: - java

App is crashing when I click on back button on Map activity.
Adding moveTaskToBack(true); in onBackPressed() not worked.
Below is the logcat:
--------- beginning of crash
2020-02-06 10:12:44.807 26120-26120/com.xxxx.user E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxxx.user, PID: 26120
java.lang.RuntimeException: Unable to destroy activity {com.xxxx.user/com.xxxx.user.MapsActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.google.maps.api.android.lib6.impl.bt.s()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4663)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4681)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1777)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:6802)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.google.maps.api.android.lib6.impl.bt.s()' on a null object reference
at com.google.maps.api.android.lib6.impl.cv.d(:com.google.android.gms.dynamite_mapsdynamite#20142051#20.1.42 (040408-0):27)
at com.google.android.gms.maps.internal.q.a(:com.google.android.gms.dynamite_mapsdynamite#20142051#20.1.42 (040408-0):30)
at cm.onTransact(:com.google.android.gms.dynamite_mapsdynamite#20142051#20.1.42 (040408-0):5)
at android.os.Binder.transact(Binder.java:504)
at com.google.android.gms.internal.maps.zza.zzb(Unknown Source)
at com.google.android.gms.maps.internal.zzj.onDestroyView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zza.onDestroyView(Unknown Source)
at com.google.android.gms.dynamic.DeferredLifecycleHelper.onDestroyView(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onDestroyView(Unknown Source)
at androidx.fragment.app.Fragment.performDestroyView(Fragment.java:2811)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:954)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2659)
at androidx.fragment.app.FragmentManagerImpl.dispatchDestroy(FragmentManagerImpl.java:2644)
at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:329)
at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:366)
at androidx.appcompat.app.AppCompatActivity.onDestroy(AppCompatActivity.java:233)
at com.xxxx.user.MapsActivity.onDestroy(MapsActivity.java:250)
at android.app.Activity.performDestroy(Activity.java:7183)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1153)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4650)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4681) 

Looks to me that you are just attempting to call a method to an interface or object that is not initialized on line 250:
com.xxxx.user.MapsActivity.onDestroy(MapsActivity.java:250)

Related

Facebook App Event sdk 4.38.0 throws NPE in ViewHierarchy.setAppearanceOfView

I'm having a problem in one of my apps where I use facebook sdk. After upgrading sdk from 4.27.0 to 4.38.0 fabric started to log this fatal exception. I don't know when or how it happens cause i can't reproduce it myself. Maybe some of you had this problem after upgrading facebook SDK.
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
at com.facebook.appevents.codeless.internal.ViewHierarchy.setAppearanceOfView(ViewHierarchy.java:182)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:197)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.getClickableElementsOfView(ButtonIndexer.java:206)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.attachListeners(ButtonIndexer.java:166)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.process(ButtonIndexer.java:161)
at com.facebook.marketing.internal.ButtonIndexer$ViewProcessor.run(ButtonIndexer.java:145)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6221)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
The fixed version 4.40.0 of the facebook android SDK was recently released:
https://developers.facebook.com/docs/android/change-log-4x/
https://github.com/facebook/facebook-android-sdk/releases/tag/sdk-version-4.40.0

Firestore internal error on initialisation

My app keeps force closing in onCreate at the point where I initialise my Firebase.java class.
This is the constructor for the Firebase.java class.
public Firebase(Context context, ProgressChecker progressChecker) {
db = FirebaseFirestore.getInstance();
FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
.setTimestampsInSnapshotsEnabled(true)
.build();
db.setFirestoreSettings(settings);
batch = db.batch();
}
This is the stack trace that I get from Crashlytics.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: julio.ai.moyela.tito.timetoolay, PID: 4740
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at ecb.b(SourceFile:324)
at ece.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ExceptionInInitializerError
at esr.<clinit>(SourceFile:82)
at evl.b(SourceFile:103)
at evm.b(SourceFile:46)
at evm.a(SourceFile:26)
at ese.a(SourceFile:70)
at ebh.<init>(SourceFile:88)
at dwp.a(SourceFile:1217)
at dwr.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at ecb$a.run(SourceFile:190)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Package.getImplementationVersion()' on a null object reference
at etx.b(SourceFile:742)
at etx.<clinit>(SourceFile:197)
at esr.<clinit>(SourceFile:82) 
at evl.b(SourceFile:103) 
at evm.b(SourceFile:46) 
at evm.a(SourceFile:26) 
at ese.a(SourceFile:70) 
at ebh.<init>(SourceFile:88) 
at dwp.a(SourceFile:1217) 
at dwr.run(Unknown Source) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
at ecb$a.run(SourceFile:190) 
at java.lang.Thread.run(Thread.java:761) 
I honestly don't know what else to include because this is a Runtime error. It only occurs in my release build, and it stops occurring when I just get rid of the Firestore initialisation.
I am running these firebase libraries as well.
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-invites:16.0.0'
implementation 'com.google.firebase:firebase-firestore:17.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'

java.lang.NoSuchFieldError: No static field KL of type Lcom/google/android/gms/internal/zzsb$zzb

I'm trying to open a Camera Activity on my Android but I got this error when the Activity starts:
FATAL EXCEPTION: main
Process: bookreader.bookreader, PID: 19132
java.lang.NoSuchFieldError: No static field KL of type Lcom/google/android/gms/internal/zzsb$zzb; in class Lcom/google/android/gms/internal/zzsb; or its superclasses (declaration of 'com.google.android.gms.internal.zzsb' appears in /data/app/bookreader.bookreader-1/split_lib_dependencies_apk.apk:classes4.dex)
at com.google.android.gms.vision.text.internal.client.zze.zzcic(Unknown Source)
at com.google.android.gms.vision.text.internal.client.zze.<init>(Unknown Source)
at com.google.android.gms.vision.text.TextRecognizer$Builder.build(Unknown Source)
at bookreader.bookreader.CameraActivity.onCreate(CameraActivity.java:97)
at android.app.Activity.performCreate(Activity.java:6609)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3113)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3275)
at android.app.ActivityThread.access$1000(ActivityThread.java:218)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:7007)
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:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
I don't know how to solve it. In my Android Manifest, I have this:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
make sure everything is up to date inside your build.gradle
no such method/field/class error usually occur because of dependency version mismatch (obfuscated fields names may be different across versions)

java.lang.IllegalAccessError on updating Firebase Auth from version 9.6.1 to 9.8.0

i recently updated Firebase Auth version in my app to 9.8.0 from 9.6.1. However, when I run the app, it crashes instantly. I get following error in the logcat:
java.lang.IllegalAccessError: Interface com.google.android.gms.internal.zzanb implemented by class com.google.firebase.auth.FirebaseAuth is inaccessible (declaration of 'com.google.firebase.auth.FirebaseAuth' appears in /data/data/com.svtech.thirdeye.thirdeye/files/instant-run/dex/slice-com.google.firebase-firebase-auth-9.6.1_65404207295ac58253e1599e984563499e3fff8b-classes.dex)
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:338)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
at com.android.tools.fd.runtime.IncrementalClassLoader.findClass(IncrementalClassLoader.java:62)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1801)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1776)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5427)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5000)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4940)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
What is causing this error?? How can I get rid of it???
Disable Instant run on your Android Studio and re-run the app.
To disable Instant Run:
Open the Settings or Preferences dialog.
Navigate to Build,
Execution, Deployment > Instant Run.
Uncheck the box next to Enable Instant Run.

Unable to create call adapter crash when Proguard is active

I want to use ProGuard in my project. I activated the option minifyEnabled. When I open the activity that uses the library Retrofit2, the app crashes with:
Unable to create call adapter for interface retrofit2.Call
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gatafan.mydeen/com.gatafan.mydeen.ActivityPlaces}:
java.lang.IllegalArgumentException: Unable to create call adapter for interface retrofit2.Call
for method i.a
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
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)
Caused by: java.lang.IllegalArgumentException: Unable to create call adapter for interface retrofit2.Call
for method i.a
at retrofit2.ServiceMethod$Builder.a(Unknown Source)
at retrofit2.ServiceMethod$Builder.b(Unknown Source)
at retrofit2.ServiceMethod$Builder.a(Unknown Source)
at retrofit2.Retrofit.a(Unknown Source)
at retrofit2.Retrofit$1.invoke(Unknown Source)
at com.gatafan.mydeen.api.$Proxy1.a(Native Method)
at com.gatafan.mydeen.api.VenueManager.requestFoursquare(Unknown Source)
at com.gatafan.mydeen.ActivityPlaces.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
... 11 more
Caused by: java.lang.IllegalArgumentException: Call return type must be parameterized as Call<Foo> or Call<? extends Foo>
at retrofit2.Utils.e(Unknown Source)
at retrofit2.ExecutorCallAdapterFactory.a(Unknown Source)
at retrofit2.Retrofit.a(Unknown Source)
at retrofit2.Retrofit.a(Unknown Source)
... 21 more
From the github page for Retrofit there is a section explaining what to do when using proguard:
PROGUARD
If you are using Proguard in your project add the following lines to your configuration:
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
try this configuration first, before moving forward with proguard changes

Categories