Facebook App Event sdk 4.38.0 throws NPE in ViewHierarchy.setAppearanceOfView - java

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

Related

Unable to Start Activity... android.content.res.Resources$NotFoundException: Drawable com.app: drawable/abc_vector_test with resource ID #0x7f07005c

I´m trying to do an App that works with Firebase and authenticates with Google, Email and Facebook.
Is exactly in the phase of Facebook sync that I had this problem:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.aplicacintrabajandoenlanube, PID: 8112
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.aplicacintrabajandoenlanube/com.example.aplicacintrabajandoenlanube.LoginActivity}: android.content.res.Resources$NotFoundException: Drawable com.example.aplicacintrabajandoenlanube:drawable/abc_vector_test with resource ID #0x7f07005c
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
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: android.content.res.Resources$NotFoundException: Drawable com.example.aplicacintrabajandoenlanube:drawable/abc_vector_test with resource ID #0x7f07005c
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f07005c
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:891)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:673)
at android.content.res.Resources.loadDrawable(Resources.java:993)
at android.content.res.Resources.getDrawableForDensity(Resources.java:983)
at android.content.res.Resources.getDrawable(Resources.java:922)
at android.content.Context.getDrawable(Context.java:693)
at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:454)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:144)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
at androidx.appcompat.widget.ResourceManagerInternal.checkVectorDrawableSetup(ResourceManagerInternal.java:504)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:137)
at androidx.appcompat.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:411)
at androidx.appcompat.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:86)
at androidx.appcompat.app.AppCompatDelegateImpl.attachToWindow(AppCompatDelegateImpl.java:647)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureWindow(AppCompatDelegateImpl.java:623)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreate(AppCompatDelegateImpl.java:350)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:105)
at com.example.aplicacintrabajandoenlanube.LoginActivity.onCreate(LoginActivity.java:23)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime: 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: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from xml type drawable resource ID #0x7f07005c
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1264)
at android.content.res.ResourcesImpl.loadXmlDrawable(ResourcesImpl.java:952)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:877)
... 32 more
Caused by: java.io.FileNotFoundException: res/drawable/abc_vector_test.xml
at android.content.res.AssetManager.nativeOpenXmlAsset(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:1092)
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1248)
... 34 more
Just so U know, my Gradle has a folder that says 6.5, which I think is the versión of Gradle.
PS: I´m literally a starter, so I do not understand most of the things I´m doing and probably will do, so please, help me in the easiest way possible (hahahah)
Analyzing the Stack Trace clearly I can depict that, It's causing an Runtime Exception since there is exactly no Resource found named drawable/abc_vector_test in your drawable folder.
Since Android didn't found the resource it's raising an Resource Not Found Exception. Kindly create the drawable file and then try running the app once.
For more information read the documentation here

Unhandled exceptions from DropBox API in Android Studio

I am trying to implement DropBox in my android app following instructions as given here . (using gradle)
When I get to the line: FullAccount account = client.users().getCurrentAccount(); I recieve the error
Unhandled exceptions: com.dropbox.core.DbxApiException, com.dropbox.core.DbxException
from the getCurrentAccount() part.
I can follow the suggestion to 'surround with try/catch' but if I do this the app crashes upon loading.
Apologies in advance for my ignorance. I am learning as I go along.
UPDATE:
I have realised I do not have the throws DbxException in my code. Trying the place it after onCreate method gives the error
'onCreate(Bundle)' in 'com.example.MyApp.MainActivity' clashes with 'onCreate(Bundle)' in 'androidx.appcompat.app.AppCompatActivity'; overridden method does not throw 'com.dropbox.core.DbxApiException'
LOGCAT DATA:
2020-07-30 17:53:50.011 10050-10050/com.example.stockscan_alpha3 E/TypefaceCompatApi26Impl: Unable to collect necessary methods for class java.lang.NoSuchMethodException
java.lang.NoSuchMethodException: android.graphics.FontFamily.<init> []
at java.lang.Class.getConstructor0(Class.java:2332)
at java.lang.Class.getConstructor(Class.java:1728)
at androidx.core.graphics.TypefaceCompatApi26Impl.obtainFontFamilyCtor(TypefaceCompatApi26Impl.java:321)
at androidx.core.graphics.TypefaceCompatApi26Impl.<init>(TypefaceCompatApi26Impl.java:84)
at androidx.core.graphics.TypefaceCompatApi28Impl.<init>(TypefaceCompatApi28Impl.java:36)
at androidx.core.graphics.TypefaceCompat.<clinit>(TypefaceCompat.java:47)
at androidx.core.graphics.TypefaceCompat.create(TypefaceCompat.java:190)
at androidx.appcompat.widget.AppCompatTextView.setTypeface(AppCompatTextView.java:705)
at android.widget.TextView.resolveStyleAndSetTypeface(TextView.java:2183)
at android.widget.TextView.setTypefaceFromAttrs(TextView.java:2154)
at android.widget.TextView.applyTextAppearance(TextView.java:4105)
at android.widget.TextView.<init>(TextView.java:1630)
at android.widget.TextView.<init>(TextView.java:990)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:99)
at androidx.appcompat.widget.AppCompatTextView.<init>(AppCompatTextView.java:95)
at androidx.appcompat.app.AppCompatViewInflater.createTextView(AppCompatViewInflater.java:182)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1059)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.stockscan_alpha3.MainActivity.onCreate(MainActivity.java:48)
at android.app.Activity.performCreate(Activity.java:7995)
at android.app.Activity.performCreate(Activity.java:7979)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
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)
2020-07-30 17:53:50.149 10050-10050/com.example.stockscan_alpha3 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.stockscan_alpha3, PID: 10050
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.stockscan_alpha3/com.example.stockscan_alpha3.MainActivity}: android.os.NetworkOnMainThreadException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
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: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1600)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:115)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:103)
at java.net.InetAddress.getAllByName(InetAddress.java:1152)
at com.android.okhttp.Dns$1.lookup(Dns.java:41)
at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:178)
at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144)
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:86)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:176)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:128)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:289)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:232)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:465)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:262)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:219)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:30)
at com.dropbox.core.http.StandardHttpRequestor.getOutputStream(StandardHttpRequestor.java:132)
at com.dropbox.core.http.StandardHttpRequestor.access$000(StandardHttpRequestor.java:29)
at com.dropbox.core.http.StandardHttpRequestor$Uploader.<init>(StandardHttpRequestor.java:141)
at com.dropbox.core.http.StandardHttpRequestor.startPost(StandardHttpRequestor.java:73)
at com.dropbox.core.http.StandardHttpRequestor.startPost(StandardHttpRequestor.java:29)
at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:276)
at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:146)
at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:330)
at com.dropbox.core.v2.DbxRawClientV2.executeRetriableWithRefresh(DbxRawClientV2.java:351)
at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:137)
at com.dropbox.core.v2.users.DbxUserUsersRequests.getCurrentAccount(DbxUserUsersRequests.java:161)
at com.example.stockscan_alpha3.MainActivity.testDropBox(MainActivity.java:138)
at com.example.stockscan_alpha3.MainActivity.onCreate(MainActivity.java:79)
at android.app.Activity.performCreate(Activity.java:7995)
at android.app.Activity.performCreate(Activity.java:7979)
You may be getting this error because it is a network call and you need to implement some kind of callback. Looking at the Dropbox SDK you will need something like this:
new GetCurrentAccountTask(DropboxClientFactory.getClient(), new GetCurrentAccountTask.Callback() {
#Override
public void onComplete(FullAccount result) {
// handle logic
}
#Override
public void onError(Exception e) {
Log.e(getClass().getName(), "Failed to get account details.", e);
}
}).execute();

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

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)

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'

how to fix java.lang.NoClassDefFoundError crash

My app is live on play store. Its not crashing in all devices but I can see this crash in a few device only. Please help me to fix this issue.
java.lang.NoClassDefFoundError: Failed resolution of:
Lcom/google/android/gms/auth/api/phone/SmsRetriever; at
com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250)
at
com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188)
at
com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372)
at
com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:627)
at
com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57)
at
com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189)
at
com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176)
at
android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at
android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at
android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102) at
android.os.Looper.loop(Looper.java:148) at
android.app.ActivityThread.main(ActivityThread.java:5417) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused
by: java.lang.ClassNotFoundException: Didn't find class
"com.google.android.gms.auth.api.phone.SmsRetriever" on path:
DexPathList[[zip file
"/data/app/gharkadabba.gharkadabba-1/base.apk"],nativeLibraryDirectories=[/data/app/gharkadabba.gharkadabba-1/lib/x86,
/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
com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250) 
at
com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188) 
at
com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372) 
at
com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:627) 
at
com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57) 
at
com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189) 
at
com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176) 
at
android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297) 
at
android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46) 
at
android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116) 
at android.os.Handler.dispatchMessage(Handler.java:102)  at
android.os.Looper.loop(Looper.java:148)  at
android.app.ActivityThread.main(ActivityThread.java:5417)  at
java.lang.reflect.Method.invoke(Native Method)  at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Suppressed: java.lang.ClassNotFoundException:
com.google.android.gms.auth.api.phone.SmsRetriever 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)
Caused by: java.lang.NoClassDefFoundError: Class not found using
the boot class loader; no stack trace available
I can see Moto G (3rd & 4th Gen), One Plus one device having crash.
I added below line to ProGuard file.
-ignorewarnings
-keep class * { public private *; }
SMS Retriever API is available in Google Play Services v10.2 and is used to auto-verify the OTP SMS.
https://developers.google.com/identity/sms-retriever/
This API will not be available in the devices that do not have Google Play Services installed - like Amazon Fire devices or the devices in the Chinese region.
If you are using this API, you have to check whether Play services are installed in the device before accessing this API.
Looking at your exception, it seems this API has been used by some Facebook kit.

Categories