omadahealth / LolliPin

A Material design Android pincode library. Supports Fingerprint.
MIT License
1.6k stars 426 forks source link

java.lang.NullPointerException for initLayoutForFingerprint #184

Open Vojtas87 opened 6 years ago

Vojtas87 commented 6 years ago

Hello,

I received this crash report in my app (devices with Android 8.1):

`java.lang.NullPointerException com.github.omadahealth.lollipin.lib.managers.AppLockActivity.initLayoutForFingerprint

java.lang.RuntimeException: at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3581) at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3621) at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2862) at android.app.ActivityThread.-wrap11 (Unknown Source) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1589) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loop (Looper.java:164) at android.app.ActivityThread.main (ActivityThread.java:6494) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:440) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

Caused by: java.lang.NullPointerException: at com.github.omadahealth.lollipin.lib.managers.AppLockActivity.initLayoutForFingerprint (AppLockActivity.java:147) at com.github.omadahealth.lollipin.lib.managers.AppLockActivity.onResume (AppLockActivity.java:84) at android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1355) at android.app.Activity.performResume (Activity.java:7117) at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3556)`

Could you take a look at this, please?

Thank you in advance.

anton-piliugin commented 6 years ago

Fixed that by removing a build library from dependencies and added "lib" dir from github sources.

  1. Remove "implementation('com.github.omadahealth:lollipin:2..." from build.gradle
  2. Add "implementation project(':lib')" to build.gradle
  3. Add "include ':lib'" to your settings.gradle
  4. Copy(change if needed) variables from gradle.properties in lollipin github sources to your gradle.properties file
  5. Change to: if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected() && mFingerprintUiHelper.isFingerprintAuthAvailable() on line 147 in AppLockActivity.java

P.S.: FOR LOLLIPIN DEVELOPERS - Added a pull request. Please add also a fresh version which includes this fix to all of your repositories

Vojtas87 commented 6 years ago

@anton-piliugin I can confirm it works! Affected users are happy now! Great tutorial. Thank you very much!

anton-piliugin commented 6 years ago

@anton-piliugin I can confirm it works! Affected users are happy now! Great tutorial. Thank you very much!

Awesome! Will see when developers of Lollipin will release a new version with fix

alexkeramidas commented 6 years ago

Yeah same here, using the lollipin library as a project lib dependency and not as suggested in the docs for ages now.