question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Huawei Android 7.0 java.lang.NullPointerException

See original GitHub issue

Thanks for the hard work on this package!

I’m not sure this is an issue with this library, but I wanted to document it in case others are also experiencing it (it looks similar to https://github.com/iamMehedi/Secured-Preference-Store/issues/25).

When uploading our app to the Google Play store, google’s pre-launch report indicates that the app is crashing with a null pointer exception (see stack trace at bottom). On launch our app (abbreviated) calls:

  createStoreSecret = () => Keychain
    .setGenericPassword('user', 'password')
    .then(() => {
      // success
    })

  Keychain
    .getGenericPassword()
    .then((credentials) => {
      if (credentials) {
        // success
      } else {
        createStoreSecret();
      }
    }).catch(() => {
      createStoreSecret();
    });

Should we not do this?

Using version 2.0.0-rc of this package.

Environment:
  OS: macOS Sierra 10.12.6
  Node: 6.9.5
  Yarn: Not Found
  npm: 3.10.10
  Watchman: 4.7.0
  Xcode: Xcode 9.1 Build version 9B55
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.0.0
  react-native: 0.51.1

Stacktrace:

java.lang.NullPointerException: Attempt to invoke interface method 'int android.security.IKeystoreService.del(java.lang.String, int)' on a null object reference
	at android.security.KeyStore.delete(KeyStore.java:186)
	at android.security.Credentials.deletePrivateKeyTypeForAlias(Credentials.java:292)
	at android.security.Credentials.deleteAllTypesForAlias(Credentials.java:251)
	at android.security.keystore.AndroidKeyStoreKeyGeneratorSpi.engineGenerateKey(AndroidKeyStoreKeyGeneratorSpi.java:329)
	at javax.crypto.KeyGenerator.generateKey(KeyGenerator.java:580)
	at com.oblador.keychain.cipherStorage.CipherStorageKeystoreAESCBC.encrypt(CipherStorageKeystoreAESCBC.java:78)
	at com.oblador.keychain.KeychainModule.setGenericPasswordForOptions(KeychainModule.java:65)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:374)
	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
	at android.os.Handler.handleCallback(Handler.java:755)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
	at android.os.Looper.loop(Looper.java:156)
	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
	at java.lang.Thread.run(Thread.java:776)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
phillbakercommented, Jun 20, 2018

@maxkomarychev makes sense to me - if we do get an exception in JS we can display the problem to the user and handle appropriately.

0reactions
obladorcommented, Jul 20, 2018

This should be “solved” in 3.0.0. Closing this for now, reopen if issues persist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cause for NullPointerException at android.support.v7.widget ...
Hello I guess this kind of error usually fire when you miss to apply setLayoutManager to your recycler view. Make sure you apply...
Read more >
NullPointerException at androidx.compose.ui.platform ...
java :21654) ... Crash reproduced on Huawei device: Huawei Y5p Android 10. Steps to reproduce. Run the project; Enter any 6 digit passcode;...
Read more >
How to make HMS ML Kit run from Background Service in ...
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context com.huawei.agconnect. ... 7replies.
Read more >
Build.VERSION_CODES - Android Developers
Android Platform. Packages. API level. REL, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,...
Read more >
NullPointerException happened in com.google.android.gms ...
at java.lang.reflect.Method. ... NullPointerException: Attempt to invoke interface method 'android.view. ... All happened in HUAWEI devices: HWY625-U.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found