My app closes on physical device as soon as startup - android

I am testing a demo of an integration, it is an ionic application (with cordova)
I created the android platform and when I run it on emulators with API 26, 30 or 31, it works correctly; but I find that when testing on a physical device (API 31) as soon as I open it, it loads the splash and then closes.
I add the code that shows the terminal, I have searched in several forums and none of the solutions seem to fit my problem
I/chromium: [INFO:CONSOLE(100770)] "Ionic Native: deviceready event fired after 2039 ms", source: http://localhost/vendor-es2015.js (100770)
W/KeyStore: KeyStore exception
android.os.ServiceSpecificException: (code 7)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2387)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.security.keystore.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:988)
at android.security.KeyStore.get(KeyStore.java:233)
at android.security.KeyStore.get(KeyStore.java:222)
at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificate(AndroidKeyStoreSpi.java:160)
at java.security.KeyStore.getCertificate(KeyStore.java:1120)
at com.crypho.plugins.RSA.loadKey(RSA.java:71)
at com.crypho.plugins.RSA.isEntryAvailable(RSA.java:51)
at com.crypho.plugins.SecureStorage.execute(SecureStorage.java:105)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:342)
at android.os.Looper.loop(Looper.java:197)
at android.os.HandlerThread.run(HandlerThread.java:67)
W/KeyStore: KeyStore exception
android.os.ServiceSpecificException: (code 7)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2387)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.security.keystore.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:988)
at android.security.KeyStore.get(KeyStore.java:233)
at android.security.KeyStore.get(KeyStore.java:222)
at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificate(AndroidKeyStoreSpi.java:165)
at java.security.KeyStore.getCertificate(KeyStore.java:1120)
at com.crypho.plugins.RSA.loadKey(RSA.java:71)
at com.crypho.plugins.RSA.isEntryAvailable(RSA.java:51)
at com.crypho.plugins.SecureStorage.execute(SecureStorage.java:105)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:342)
at android.os.Looper.loop(Looper.java:197)
at android.os.HandlerThread.run(HandlerThread.java:67)
W/PluginManager: THREAD WARNING: exec() call to SecureStorage.init blocked the main thread for 42ms. Plugin should use CordovaInterface.getThreadPool().
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ionicframework.suacimobile257509, PID: 22032
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.credentials.UNLOCK }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2067)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
at android.app.Activity.startActivityForResult(Activity.java:5412)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:345)
at android.app.Activity.startActivityForResult(Activity.java:5370)
at android.app.Activity.startActivity(Activity.java:5760)
at android.app.Activity.startActivity(Activity.java:5713)
at com.crypho.plugins.SecureStorage.startActivity(SecureStorage.java:240)
at com.crypho.plugins.SecureStorage.access$700(SecureStorage.java:21)
at com.crypho.plugins.SecureStorage$4.run(SecureStorage.java:217)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7803)
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:958)
D/SERVER: Handling local request: http://localhost/7-es2015.js
I/Process: Sending signal. PID: 22032 SIG: 9

I managed to solve the problem by focusing on this line
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.credentials.UNLOCK }
It turns out that it is a matter of one of the dependencies that fails in some cases yes and others no from API 28, I add the link from where I was guided
https://github.com/Crypho/cordova-plugin-secure-storage/issues/169#issuecomment-509734410

Related

FirebaseApp with name APP_ID doesn't exist. Available app names: [DEFAULT]

I have a react native app that has firebase modules such as
"#react-native-firebase/app": "^14",
"#react-native-firebase/messaging": "^14",
App is working fine with debugging mode, Apk is also fine, but when I publish it to google play internal testing, App is crashing after installing it with below error! There is no issue with app ids and json file. I have already double checked it.
FATAL EXCEPTION: mqt_native_modules
Process: com.app, PID: 26684
java.lang.IllegalStateException: FirebaseApp with name XXXXXXXXXXXXX doesn't exist. Available app names: [DEFAULT]
at com.google.firebase.FirebaseApp.getInstance(Unknown Source:83)
at io.invertase.firebase.messaging.ReactNativeFirebaseMessagingModule.getToken(Unknown Source:0)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(Unknown Source:148)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(Unknown Source:21)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(Unknown Source:0)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(Unknown Source:37)
at java.lang.Thread.run(Thread.java:1012)
2023-01-15 01:35:51.642 1629-2656 ActivityManager
pid-1629

Android - Method addObserver must be called on the main thread

I got this error trying to setup Revenue Cat Purchases 3.4.3 on React Native.
RN 0.67
2022-02-28 07:58:39.154 5945-8093/com.farms E/unknown:ReactNative: Exception in native call
java.lang.IllegalStateException: Method addObserver must be called on the main thread
at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:172)
at com.revenuecat.purchases.Purchases.(Purchases.kt:160)
at com.revenuecat.purchases.Purchases$Companion.configure(Purchases.kt:1593)
at com.revenuecat.purchases.Purchases$Companion.configure$default(Purchases.kt:1560)
at com.revenuecat.purchases.common.CommonKt.configure(common.kt:271)
at com.revenuecat.purchases.react.RNPurchasesModule.setupPurchases(RNPurchasesModule.java:73)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:237)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
at java.lang.Thread.run(Thread.java:919)
Anyone faced it? Thanks!
EDIT:
Ok! Updating to react-native-purchases 4.5.2 solves the problem!

JobInfoSchedulerService from firebase-android-sdk crashing with DeadSystemException

I am facing crashes in my android app w.r.t. firebase-android-sdk. I use the following firebase components in my app:
firebase-crashlytics - 17.3.1
firebase-config - 20.0.3
firebase-analytics - 18.0.2
Here is the stack trace of the crash in firebase JobInfoSchedulerService:
Fatal Exception: java.lang.RuntimeException: Unable to create service com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService: java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4180)
at android.app.ActivityThread.access$1600(ActivityThread.java:232)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:7604)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
The app does not use any of the API(s) in com.google.android.datatransport which comes with Firebase. Please help me understand and fix the underlying cause of this issue.

java.lang.IllegalStateException: Could not execute method for android:onClick In HMS Scan Kit

I'm trying to implement the Scan kit getting below error.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.huawei.hmsscankitexample, PID: 27532
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:402)
at android.view.View.performClick(View.java:7213)
at android.view.View.performClickInternal(View.java:7187)
at android.view.View.access$3500(View.java:828)
at android.view.View$PerformClick.run(View.java:27675)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8285)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397)
at android.view.View.performClick(View.java:7213) 
at android.view.View.performClickInternal(View.java:7187) 
at android.view.View.access$3500(View.java:828) 
at android.view.View$PerformClick.run(View.java:27675) 
at android.os.Handler.handleCallback(Handler.java:900) 
at android.os.Handler.dispatchMessage(Handler.java:103) 
at android.os.Looper.loop(Looper.java:219) 
at android.app.ActivityThread.main(ActivityThread.java:8285) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) 
Caused by: java.lang.NullPointerException
at android.graphics.Bitmap.compress(Bitmap.java:1544)
at com.huawei.hmsscankitexample.activity.ProfileActivity.downloadQrCode(ProfileActivity.java:218)
at java.lang.reflect.Method.invoke(Native Method) 
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397) 
at android.view.View.performClick(View.java:7213) 
at android.view.View.performClickInternal(View.java:7187) 
at android.view.View.access$3500(View.java:828) 
at android.view.View$PerformClick.run(View.java:27675) 
at android.os.Handler.handleCallback(Handler.java:900) 
at android.os.Handler.dispatchMessage(Handler.java:103) 
at android.os.Looper.loop(Looper.java:219) 
at android.app.ActivityThread.main(ActivityThread.java:8285) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055) 
2020-07-16 22:22:06.951 27532-27532/com.huawei.hmsscankitexample I/Process: Sending signal. PID: 27532 SIG: 9
It appears you're getting a Null Pointer exception:
Caused by: java.lang.NullPointerException at
android.graphics.Bitmap.compress(Bitmap.java:1544) at
com.huawei.hmsscankitexample.activity.ProfileActivity.downloadQrCode(ProfileActivity.java:218)
You can check the documentation on the Huawei Developer website for more information on result codes. Here is the link.
Result Code 10009 “The number of ongoing data export tasks of an app exceeds the upper limit (3).”
The answer provided in the link below explains further why this error occurs.
HMS Awareness Kit-Error code 10011 is returned after the SDK is integrated
This error is caused by too frequent API calls. Currently, there are two restrictions on calling the APIs of HUAWEI Awareness Kit:
1. The number of API calls within 1 hour cannot exceed 1000.
2. The number of API calls within 5 seconds cannot exceed 20.
The reasons for such restrictions are as follows:
1. Frequent API calls in a short period of time are not normal service requirements.
2. Frequent API calls increase the workload of HMS Core and even cause a failure to provide services for other developers.
The restrictions are only a temporary workaround, and will be eliminated after service optimization.

FATAL EXCEPTION: ControllerMessenger

can someone help me to fix these errors. I added my app to the firebase and did test run. and I got these errors. I am new to android app development. I have no clear idea where should I start to fix these errors.
Fatal exception
android.os.FileUriExposedException: file:///storage/emulated/0/QR%20and%20Barcode/text.png exposed beyond app through ClipData.Item.getUri()
FATAL EXCEPTION: ControllerMessenger
Process: one.teqtoapps.barqr, PID: 9659
android.os.FileUriExposedException: file:///storage/emulated/0/QR%20and%20Barcode/text.png exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed(Uri.java:2348)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:941)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9735)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9741)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9720)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1609)
at androidx.test.runner.MonitoringInstrumentation.execStartActivity(MonitoringInstrumentation.java:152)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:68)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:751)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at one.teqtoapps.barqr.utility.AppUtils.share(AppUtils.java:83)
at one.teqtoapps.barqr.fragment.GenerateFragment$6.onSaved(GenerateFragment.java:183)
at one.teqtoapps.barqr.utility.SaveImage.onPostExecute(SaveImage.java:41)
at one.teqtoapps.barqr.utility.SaveImage.onPostExecute(SaveImage.java:16)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:105)
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:96)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:37)
at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:74)
at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:52)
at androidx.test.espresso.action.Tap.c(Tap.java:9)
at androidx.test.espresso.action.Tap.a(Tap.java:19)
at androidx.test.espresso.action.Tap$1.b(Tap.java:2)
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:266)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I got the same Crashes on some devices during Google Play test
I thought this will help you :
https://issuetracker.google.com/issues/113164874
In my case, it show in log
Failed to take screenshot: takeScreenshot returned null
copied 4 bytes
01-29 06:27:43.544: I/Robo(11035): --------- beginning of crash
01-29 06:27:43.545: E/AndroidRuntime(11035): FATAL EXCEPTION: ControllerMessenger
01-29 06:27:43.545: E/AndroidRuntime(11035): Process: PID: 11035
01-29 06:27:43.545: E/AndroidRuntime(11035): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Bitmap.recycle()' on a null object reference
because my screen has secure flag to take screen-shot and testing framework trying to take screen-shot that will return null and throwing NullPointerException on recycle.
For more help you can reply me here.

Categories

Resources