Android app crash by "FileNotFoundException for drawable in drawable-xhdpi-v4" - android

guys.I got a crash becasue of "java.io.FileNotFoundException: res/drawable-xhdpi-v4/component_tip_loading1.png".
But I unziped my apk and found the resource is existed.
And my build.gradle set minifyEnabled is true, but not set the shrinkResources.
Thanks for any advice.
Caused by: java.io.FileNotFoundException: res/drawable-xhdpi-v4/component_tip_loading1.png
at android.content.res.AssetManager.openNonAssetNative(Native Method)
at android.content.res.AssetManager.openNonAsset(AssetManager.java:405)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2443)

Related

App crashes in release apk which run correctly in debug mode

I have tested my app in debug mode. I have made debuggable as true in release build type in build.gradle file. When I run and test it it gives me following error
2022-10-20 13:17:16.300 26285-26285/com.metamagics.patientsapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.metamagics.patientsapp, PID: 26285
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.metamagics.pulsepatientsapp.d.h.a()' on a null object reference
at com.metamagics.pulsepatientsapp.fragments.a.V1(:487)
at com.metamagics.pulsepatientsapp.fragments.a$f.c(:1657)
at com.metamagics.pulsepatientsapp.utilities.b.b(:129)
at com.metamagics.pulsepatientsapp.utilities.b.onPostExecute(:10)
at android.os.AsyncTask.finish(AsyncTask.java:771)
at android.os.AsyncTask.access$900(AsyncTask.java:199)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8057)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
I am not able to understand the issue, if anyone knows a better way to identify the error, I will be thankful.
If you debug a release build, it will still be minified according to your build.gradle file. Try to first set minifyEnabled = false for your release configuration. Probably the Stacktrace gives you the reason of your error. If not you might need to configure your proguard rules if minify is needed.

Android: Internal error in Cloud Firestore (24.0.2)

Iam using Firestore 24.0.2, and it was working well, but now i surprised that it is not working, and the app crash when opening MainActivity after Splash Activity.
I tried to remove some dependencies and the problem still exist.
So, After the app run:
First -> Splash Screen shown with some code from Firebase RemoteConfig, and it works well.
Second -> It moves to Main Activity which has Fragments that use Firestore, after less than one second from show Main Activity, the app crash, with java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.2)
I've seen a lot of threads and questions on Stack Overflow, GitHub, and more sites, and no solution worked for me.
Full Crash Code:
java.lang.RuntimeException: Internal error in Cloud Firestore (24.0.2).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:539)
at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda3.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.RuntimeException: android.database.sqlite.SQLiteException: not an error (code 0 SQLITE_OK[0])
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:330)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:234)
at java.lang.Thread.run(Thread.java:923)
Caused by: android.database.sqlite.SQLiteException: not an error (code 0 SQLITE_OK[0])
at android.database.sqlite.SQLiteConnection.nativeRegisterLocalizedCollators(Native Method)
at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:647)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:387)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:980)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:444)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:387)
at com.google.firebase.firestore.local.SQLitePersistence.start(SQLitePersistence.java:138)
at com.google.firebase.firestore.core.ComponentProvider.initialize(ComponentProvider.java:139)
at com.google.firebase.firestore.core.FirestoreClient.initialize(FirestoreClient.java:272)
at com.google.firebase.firestore.core.FirestoreClient.lambda$new$0$com-google-firebase-firestore-core-FirestoreClient(FirestoreClient.java:109)
at com.google.firebase.firestore.core.FirestoreClient$$ExternalSyntheticLambda17.run(Unknown Source:8)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:441)
at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda6.call(Unknown Source:2)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:327)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda0.run(Unknown Source:4) 
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:234) 
at java.lang.Thread.run(Thread.java:923) 
I have tried many available answers like disable minify enable as false, which in not a right approach. Adding a line in pro-guard finally resolved the issue after 2 days of hard work.
-keep class io.grpc.** {*;}
I just had to revert to Firestore 24.0.0 and it stopped.
In my case, I forgot to put await on every Firebase.initializeApp().
await Firebase.initializeApp(name: 'noPersist', options: options);
await Firebase.initializeApp();
FirebaseDatabase.instance.setPersistenceEnabled(true);
As of today i ran into this issue and solved it by adding this little block of code to my andriod/app/build_gradle
release {
signingConfig signingConfigs.release
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

Flutter Firestore doesn't retrieve any data in released android apk

I have tried to develop a flutter application that uses firestore and firebase auth for authentication.
In debug mode, when I test the application it retrieves data from firestore and show it. and firebase auth also work properly.
But in release mode, Firestore doesn't retrieve any data and shows an error given below.
but Firebase auth perfectly works in release mode application.
I catch the error in release mode by using android studio build variant feature.
Thank you for reading.
E/io.grpc.internal.S1: [Channel<1>: (firestore.googleapis.com)] Uncaught exception in the SynchronizationContext. Panic!
java.lang.ExceptionInInitializerError
at m1.j.Q(Unknown Source:22)
at io.grpc.internal.D.Q(Unknown Source:4)
at io.grpc.internal.k1.A(:3)
at io.grpc.internal.a1.run(:2)
at k1.t1.a(Unknown Source:24)
at k1.t1.execute(:2)
at io.grpc.internal.K1.b(Unknown Source:9)
at io.grpc.internal.u0.a(:10)
at io.grpc.internal.u0.run(Unknown Source:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: o1.a.values []
at java.lang.Enum.enumValues(Enum.java:270)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumMap.getKeyUniverse(EnumMap.java:755)
at java.util.EnumMap.<init>(EnumMap.java:138)
at m1.v.<clinit>(:1)
at m1.j.Q(Unknown Source:22) 
at io.grpc.internal.D.Q(Unknown Source:4) 
at io.grpc.internal.k1.A(:3) 
at io.grpc.internal.a1.run(:2) 
at k1.t1.a(Unknown Source:24) 
at k1.t1.execute(:2) 
at io.grpc.internal.K1.b(Unknown Source:9) 
at io.grpc.internal.u0.a(:10) 
at io.grpc.internal.u0.run(Unknown Source:38) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:919) 
Caused by: java.lang.NoSuchMethodException: o1.a.values []
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at java.lang.Enum.enumValues(Enum.java:267)
W/Firestore: (23.0.1) [Z]: (3a36b20) Stream closed with status: o1{code=INTERNAL, description=Panic! This is a bug!, cause=java.lang.ExceptionInInitializerError
at m1.j.Q(Unknown Source:22)
at io.grpc.internal.D.Q(Unknown Source:4)
at io.grpc.internal.k1.A(:3)
at io.grpc.internal.a1.run(:2)
at k1.t1.a(Unknown Source:24)
at k1.t1.execute(:2)
at io.grpc.internal.K1.b(Unknown Source:9)
at io.grpc.internal.u0.a(:10)
at io.grpc.internal.u0.run(Unknown Source:38)
This is a common error with Firestore. The problem is with the minifyEnabled and shrinkResources fields in android/app/build.gradle.
You should be able to solve this by changing your release build type in android/app/build.gradle as follows:
buildTypes {
...
release {
...
signingConfig signingConfigs.release
minifyEnabled false
shrinkResources false
}
}
Of course this is not an ideal "solution" as the app-size becomes larger. But the Firebase team says they can't help because we use flutter which isn't officially supported...
Here are related issues:
https://github.com/FirebaseExtended/flutterfire/discussions/5708#discussioncomment-925997
https://github.com/FirebaseExtended/flutterfire/issues/1412

Android app crash on setting minifyEnabled true

Application getting crashed on enabling minifyEnabled true. When I make it false application starts working fine. Do I need to add something to my pro-guard file? I am not able to figure out what is causing an application to crash.
Here is the Gradle code:
debug {
manifestPlaceholders = [crashlyticsApiKey: '', mapApiKey: '']
// Enables code shrinking, obfuscation, and optimization for only
debuggable true
// your project's release build type.
minifyEnabled true
// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "BASE_URL", '"http://"'
signingConfig signingConfigs.debug
}
Logcat Output:
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ExceptionInInitializerError
at l.b.g.f$a.<init>(:372)
at l.b.g.f.<init>(:19)
at l.b.h.m.a(:32)
at l.b.h.m.b(:42)
at l.b.h.b.b(:56)
at l.b.h.g.a(:32)
at l.b.f.a.a(:135)
at l.b.f.b$d.f(:747)
at l.b.f.b.b(:250)
at d.k.a.i.g.a(:36)
at d.k.a.i.g.doInBackground(:17)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 
Caused by: java.lang.IllegalStateException: Could not read resource entities-xhtml.properties. Make sure you copy resources for l.b.g.i
at l.b.g.i.b(:301)
at l.b.g.i.a(:25)
at l.b.g.i$b.<init>(:53)
at l.b.g.i$b.<clinit>(:34)
at l.b.g.f$a.<init>(:372) 
at l.b.g.f.<init>(:19) 
at l.b.h.m.a(:32) 
at l.b.h.m.b(:42) 
at l.b.h.b.b(:56) 
at l.b.h.g.a(:32) 
at l.b.f.a.a(:135) 
at l.b.f.b$d.f(:747) 
at l.b.f.b.b(:250) 
at d.k.a.i.g.a(:36) 
at d.k.a.i.g.doInBackground(:17) 
at android.os.AsyncTask$2.call(AsyncTask.java:295) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
at java.lang.Thread.run(Thread.java:818) 
02-10 15:19:58.687 17254-20516/? E/cjle: *~*~*~ Channel {0} was not shutdown properly!!! ~*~*~*
Make sure to call shutdown()/shutdownNow() and wait until awaitTermination() returns true.
02-10 15:20:25.416 17254-28037/? E/WakeLock: GCM_HB_ALARM release without a matched acquire!
Please let know what is wrong in my code.
Thanks
The error stack indicates this:
Caused by: java.lang.IllegalStateException: Could not read resource entities-xhtml.properties. Make sure you copy resources for l.b.g.i
I think this is because the resource/class l.b.g.i is excluded by ProGuard. You may want to use mappings.txt file (that contains mapping between actual class/method name and its random one generated by proGuard) to decode actual resource name and then force Proguard to keep it, something like this example https://stackoverflow.com/a/5866755/1992013 Hope this helps !

FileNotFoundException for drawable in drawable-xhdpi-v4

We got a crash log from Google Play and it seems some drawable in drawable-xhdpi-v4 is not found. However, we didn't have a drawable-xhdpi-v4 folder and do have edit_bg.9.png in res/drawable-xhdpi/. I found this post after searching, but it seems not helpful and no accepted answers there.
Thanks for any advice.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xhdpi-v4/edit_bg.9.png from drawable resource ID #0x7f0200bb
at android.content.res.Resources.loadDrawable(Resources.java:2172)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.<init>(View.java:3589)
at android.widget.TextView.<init>(TextView.java:642)
at android.widget.EditText.<init>(EditText.java:60)
at android.widget.EditText.<init>(EditText.java:56)
... 29 more
Caused by: java.io.FileNotFoundException: res/drawable-xhdpi-v4/edit_bg.9.png
at android.content.res.AssetManager.openNonAssetNative(Native Method)
at android.content.res.AssetManager.openNonAsset(AssetManager.java:421)
at android.content.res.Resources.loadDrawable(Resources.java:2163)
... 34 more

Categories

Resources