mjwheatley / cordova-plugin-android-fingerprint-auth

A cordova plugin for fingerprint authentication using the hardware fingerprint scanner on devices running Android 6+
Apache License 2.0
168 stars 131 forks source link

android.content.res.Resources$NotFoundException #52

Closed jskrepnek closed 5 years ago

jskrepnek commented 7 years ago

I can't reproduce this consistently. It's usually when the app is launching after it's been backgrounded for a while.

I'm essentially using version 1.2.2 of the plugin. So far only seen on Android 7.1, Nexus 5X (bullhead).

java.lang.RuntimeException: Unable to start activity ComponentInfo{ca.koho/ca.koho.Koho}: android.content.res.Resources$NotFoundException: Resource ID #0x0
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    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: android.content.res.Resources$NotFoundException: Resource ID #0x0
    at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)
    at android.content.res.Resources.loadXmlResourceParser(Resources.java:2101)
    at android.content.res.Resources.getLayout(Resources.java:1115)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:424)
    at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.onCreateView(FingerprintAuthenticationDialogFragment.java:85)
    at android.app.Fragment.performCreateView(Fragment.java:2353)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1153)
    at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2039)
    at android.app.FragmentController.dispatchActivityCreated(FragmentController.java:176)
    at android.app.Activity.performCreateCommon(Activity.java:6673)
    at android.app.Activity.performCreate(Activity.java:6681)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
    ... 9 more
mjwheatley commented 7 years ago

Hopefully this has been resolved with the fix to allow state loss in version 1.2.8 Closing this issue for now. If it is still occurring please reopen the issue.

SeeWhat commented 7 years ago

Got this exception again while using 1.3.0 on a Nexus 6P (Android 7.1.2). Stack trace is the same and occurred twice for this user. Don't have a reproducible example yet however.

jonathankau commented 7 years ago

+1 to what @SeeWhat said, although we're still on 1.2.8. We've seen about ~150 crashes on 7.0 Samsung Galaxy devices:

screen shot 2017-08-03 at 10 37 07 am

Azamat-Nurzhanuly commented 7 years ago

First of all, thank you for this plugin. It's very usefull. We have the same problem on Redmi 4, Redmi Note 3, Redmi 4X using plugin version 1.3.1. Please, could you reopen this issue and answer when the problem will be resolved? This is emergency situation. Thank you in advance.

mjwheatley commented 7 years ago

Very difficult to troubleshoot with the stack trace alone. It has been mentioned that it cannot be reproduced consistent. I can not reproduce the error so I can't debug the issue. I do not have access to the devices mentioned for testing. If you would like resolution to this issue please contribute by providing more helpful/useful information.

Azamat-Nurzhanuly commented 7 years ago

@mjwheatley, I'm sorry for long answer. I had problems that demanded my immediate attention.

I can't reproduce it neither. I saw this from crash reporter in firebase console. I have only the stack trace. But it is the same as @jskrepnek wrote.

Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{air.com.ssdsoftwaresolutions.clickuz/air.com.ssdsoftwaresolutions.clickuz.MainActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
    android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2984)
    android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3045)
    android.app.ActivityThread.-wrap14 (ActivityThread.java)
    android.app.ActivityThread$H.handleMessage (ActivityThread.java:1642)
    android.os.Handler.dispatchMessage (Handler.java:102)
    android.os.Looper.loop (Looper.java:154)
    android.app.ActivityThread.main (ActivityThread.java:6776)
    java.lang.reflect.Method.invoke (Method.java)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1496)
    com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1386)

Caused by android.content.res.Resources$NotFoundException: Resource ID #0x0
    android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:202)
    android.content.res.Resources.loadXmlResourceParser (Resources.java:2970)
    android.content.res.Resources.getLayout (Resources.java:1986)
    android.view.LayoutInflater.inflate (LayoutInflater.java:425)
    com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.onCreateView (FingerprintAuthenticationDialogFragment.java:85)
    android.app.Fragment.performCreateView (Fragment.java:2352)
    android.app.FragmentManagerImpl.moveToState (FragmentManager.java:995)
    android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1171)
    android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1153)
    android.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManager.java:2043)
    android.app.FragmentController.dispatchActivityCreated (FragmentController.java:177)
    android.app.Activity.performCreateCommon (Activity.java:6949)
    android.app.Activity.performCreate (Activity.java:6957)
    android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1126)
    android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2927)
    android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3045)
    android.app.ActivityThread.-wrap14 (ActivityThread.java)
    android.app.ActivityThread$H.handleMessage (ActivityThread.java:1642)
    android.os.Handler.dispatchMessage (Handler.java:102)
    android.os.Looper.loop (Looper.java:154)
    android.app.ActivityThread.main (ActivityThread.java:6776)
    java.lang.reflect.Method.invoke (Method.java)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1496)
    com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1386)
newuser44 commented 7 years ago

Nothing new to add, but having the same issue with our apps. Not sure what Samsung does differently with their phones.

jskrepnek commented 7 years ago

We traced most (but not all) of these to the scenario where the fragment was displayed when the application was paused. It our case it would usually happen when the power button was pressed. Have a look at the changes: https://github.com/kohofinancial/cordova-plugin-android-fingerprint-auth/commits/master.

newuser44 commented 7 years ago

Thanks for the response. I'm confused. We have version 1.31. of the plugin. The fix should be in that version? Not sure why we still get the crashes for samsung devices.

jskrepnek commented 7 years ago

@newuser44 We forked the plugin - the fixes have not come back to the origin. You'd have to look at the commits in our forked repo for details.

phyr0s commented 6 years ago

Hi Current status for this error?

dickverweij commented 6 years ago

same here .. current status?

mjwheatley commented 6 years ago

Current status: Same as my last post as no additional information has been provided to help troubleshoot the issue.

dickverweij commented 6 years ago

What do you need? we have crash logs

dickverweij commented 6 years ago

java.lang.RuntimeException: at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2924) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2985) at android.app.ActivityThread.-wrap14 (ActivityThread.java) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1635) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java:154) at android.app.ActivityThread.main (ActivityThread.java:6692) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358) Caused by: android.content.res.Resources$NotFoundException: at android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:202) at android.content.res.Resources.loadXmlResourceParser (Resources.java:2968) at android.content.res.Resources.getLayout (Resources.java:1984) at android.view.LayoutInflater.inflate (LayoutInflater.java:425) at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.onCreateView (FingerprintAuthenticationDialogFragment.java:85) at android.app.Fragment.performCreateView (Fragment.java:2352) at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:995) at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1171) at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1153) at android.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManager.java:2043) at android.app.FragmentController.dispatchActivityCreated (FragmentController.java:177) at android.app.Activity.performCreateCommon (Activity.java:6906) at android.app.Activity.performCreate (Activity.java:6914) at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1126) at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2877)

mjwheatley commented 6 years ago

Please provide steps to reproduce the issue on a simulator and the simulator config information.

dickverweij commented 6 years ago

It only happens on 7.0 devices as far as i can see. Perhaps somethings to do with theme? I cant reproduce it yet in emulators.

dickverweij commented 6 years ago

image

still more crashes every day.. (also on 8.0) ..

mjwheatley commented 6 years ago

Since you can't reproduce it in emulators, is this specific to a subset of hardware devices? Have you been able to replicate the issue on one of the effect devices? If so, maybe we can work together to resolve the issue. Do you know if the error occurs because the dialog was open when your app when to the background?

mjwheatley commented 6 years ago

Have you tried what @jskrepnek mentioned and dismiss the dialog in onPause?

@Override
     public void onPause() {
         super.onPause();
+        // Dismiss dialog to avoid doubling it on resume if app was closed by OS
+        dismissAllowingStateLoss();
         mFingerprintUiHelper.stopListening();
     }      

If we can't replicate the issue it will be difficult to determine if any changes resolve the issue.

dickverweij commented 6 years ago

thanks! .. I'll try the onPause fix. !

WuglyakBolgoink commented 6 years ago

same

image

newuser44 commented 6 years ago

Hey thanks for the support for this plugin.
Did this find a solution? This seems to be the biggest "crash" on my app.

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2955)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3030)
  at android.app.ActivityThread.-wrap11 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1696)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6938)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: android.content.res.Resources$NotFoundException: 
  at android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:216)
  at android.content.res.Resources.loadXmlResourceParser (Resources.java:2148)
  at android.content.res.Resources.getLayout (Resources.java:1157)
  at android.view.LayoutInflater.inflate (LayoutInflater.java:421)
  at com.cordova.plugin.android.fingerprintauth.FingerprintAuthenticationDialogFragment.onCreateView (FingerprintAuthenticationDialogFragment.java:85)
  at android.app.Fragment.performCreateView (Fragment.java:2611)
  at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1276)
  at android.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManager.java:1549)
  at android.app.FragmentManagerImpl.moveToState (FragmentManager.java:1611)
  at android.app.FragmentManagerImpl.dispatchMoveToState (FragmentManager.java:3045)
  at android.app.FragmentManagerImpl.dispatchActivityCreated (FragmentManager.java:2997)
  at android.app.FragmentController.dispatchActivityCreated (FragmentController.java:179)
  at android.app.Activity.performCreateCommon (Activity.java:7168)
  at android.app.Activity.performCreate (Activity.java:7176)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1220)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2908)

Was trying to locate ResourcesImpl.java:216 to get more info, not sure where the java file actually is located.

hvaughan3 commented 6 years ago

We are still getting this after adding @mjwheatley's workaround unfortunately.

mjwheatley commented 6 years ago

I am thinking because this issue is so elusive and difficult to reproduce and is only happening on a subset of devices, it could be related to the implementation. My best guess is this is happening because of a state loss when your application goes to the background when the dialog is being displayed. I can publish a version of the plugin that includes a dismiss action that will remove the dialog if it is currently displayed. Utilizing this method, you could tap in to the onpause event and dismiss the dialog before your application goes to the background. Then you could check your analytics to see of the errors stop happening all together as we are unable to replicate the issue and check to see if this solution would help at all.

Please let me know if you are interested in trying this solution.

danicholls commented 5 years ago

Any update on whether this worked? dismiss is out there, right?

mjwheatley commented 5 years ago

Yes, the dismiss() method has been published. No one experiencing this issue has commented whether or not they have implemented it or if it has had any impact.

danicholls commented 5 years ago

Just noting that per this, which is based off your work, and the reports here, I think this is handled.

mjwheatley commented 5 years ago

Thanks for the references. I will go ahead and close this issue.