val masterKey =
MasterKey
.Builder(applicationContext)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
Running this code in an Instant App crashes my app with the following Stack Trace:
2020-12-21 13:07:29.654 28949-28949/com.example.instantappandroidkeystore E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.instantappandroidkeystore, PID: 28949
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.instantappandroidkeystore/com.example.instantappandroidkeystore.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'int android.security.keystore.IKeystoreService.exist(java.lang.String, int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3448)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7814)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int android.security.keystore.IKeystoreService.exist(java.lang.String, int)' on a null object reference
at android.security.KeyStore.contains(KeyStore.java:408)
at android.security.keystore.AndroidKeyStoreSpi.engineContainsAlias(AndroidKeyStoreSpi.java:1038)
at java.security.KeyStore.containsAlias(KeyStore.java:1293)
at androidx.security.crypto.MasterKeys.keyExists(MasterKeys.java:154)
at androidx.security.crypto.MasterKeys.getOrCreate(MasterKeys.java:96)
at androidx.security.crypto.MasterKey$Builder.buildOnM(MasterKey.java:357)
at androidx.security.crypto.MasterKey$Builder.build(MasterKey.java:314)
at com.example.instantappandroidkeystore.MainActivity.onCreate(MainActivity.kt:32)
at android.app.Activity.performCreate(Activity.java:7955)
at android.app.Activity.performCreate(Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7814)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
I have no luck finding this issue in StackOverflow, but I have found it in Google Issue Tracker, but with no response. So I created submitted an issue to Google with more information. https://issuetracker.google.com/issues/176085956
Has anyone encounter this issue and was able to solve it.
My working environment is:
Mac OS 10.15.7
Android Studio 4.0.1
Samsung A70
Android version 10
While this is not documented formally on developer.android forum, looks like AndroidKeyStore access is restricted for instant apps. I came across this link https://www.reddit.com/r/androiddev/comments/7a4tdw/why_no_hardware_backed_keystore_in_instant_apps/
This is quite strange that keystore is restricted and no android documentation explains it. I am not sure on an alternative to accessing KeyStore as we have lot of dependency on keystore for our regular app (non instant) and I can't think of a better option. Looking forward for suggestions !
Related
Getting this error after deploying my app to Alpha but Prod version works great on all the devices and platforms. found this from google play console crash report but couldn't find any possible reason and solution for this.
Exception com.facebook.react.common.JavascriptException: Error: Cannot make a deep link into a standalone app with no custom scheme defined, stack:
<unknown>#854:963
E#836:3496
<unknown>#836:567
<unknown>#460:2224
h#2:1585
<unknown>#6:57
h#2:1585
d#2:958
global code#1241:3
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException (ExceptionsManagerModule.java:72)
at java.lang.reflect.Method.invoke
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
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:228)
at java.lang.Thread.run (Thread.java:920)
I'm unable to find the cause of this startup crash. It occurs on my One Plus 5t running Android 8, I don't know about other devices.
Target api: 26 (I've tried setting this to 23 too)
Minimum: 15 (I've tried setting this to 23 too)
Linking: none
Device: One Plus 5t
This is the stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setTranslationZ(float)' on a null object reference
at android.view.View$4.setValue(View.java:24481)
at android.view.View$4.setValue(View.java:24479)
at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1379)
at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:990)
at android.animation.ValueAnimator.setCurrentFraction(ValueAnimator.java:654)
at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:617)
at android.animation.ValueAnimator.start(ValueAnimator.java:1046)
at android.animation.ValueAnimator.start(ValueAnimator.java:1065)
at android.animation.ObjectAnimator.start(ObjectAnimator.java:852)
at android.animation.ValueAnimator.startWithoutPulsing(ValueAnimator.java:1058)
at android.animation.AnimatorSet.handleAnimationEvents(AnimatorSet.java:1142)
at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1046)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.-wrap2(Unknown Source:0)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:964)
at android.view.Choreographer.doCallbacks(Choreographer.java:778)
at android.view.Choreographer.doFrame(Choreographer.java:710)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
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:6809)
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)
Unhandled Exception:
Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setTranslationZ(float)' on a null object reference
void android.view.View.setTranslationZ(float)
Some nuget package was using code not running on some specific devices. Uninstalling unused packages the problem went away
Running on Android - I can no longer get my app to build. I've tried 15+ ideas on stack overflow with similar batchedbridge errors'.
Results - after packaging:
- Red error screen popups up with "Could not get BatchedBridge, make sure your bundle is packaged properly” (with no other callstack details) and then a second later get a blank white screen.
Results - after the error and then reloading from the app dev tools menu:
- Could not connect to development server
react-native version 0.40.0 npm=5.0.3 node=v7.4.0
The app was working previously for months so i'm guessing connected to a recent change, version problem, cache problem, npm version or reactnative version?
Tried adb reverse tcp:8081 tcp:8081
Tried npm cache clean
Tried on emulator and device - same issue
Tried closing all react packagers
Made sure no other react native apps/packagers running
Android app is building OK in Android Studio (without react native)
Looking in the logcat I seem some red flags but not sure if these problems are new or were previously there:
- Lots of 'ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.???????' etc
- React: The packager does not seem to be running as we got an IOException requesting its status: Connection reset
Here's the logcat snippet and stack trace from the app when it tries to start - if you need more of the logcat let me know (my attempt to add it here didn't work).
iceapp.challengeme ic=null D/FA: Connected to remote service W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLoginButtonManager V/FA: Processing queued up service tasks: 2 W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBSendButtonManager W/art: Before Android 4.1, method boolean com.facebook.share.widget.ShareButtonBase.canShare() would have incorrectly overridden the package-private method in android.widget.TextView W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBShareButtonManager
E/unknown:React: Exception in native call from JS
com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
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:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:762)
Caused by: com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
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:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:762) W/unknown:React: Packager connection already open, nooping. W/unknown:React: Inspector connection already open, nooping. E/unknown:React: Exception in native call
java.lang.RuntimeException: Error calling function: RCTDeviceEventEmitter:emit
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
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:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.lang.RuntimeException: Empty Optional cannot be unwrapped
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
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:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:762) E/unknown:React: Exception in native call
java.lang.RuntimeException: Error calling function: AppRegistry:runApplication
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
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:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.lang.RuntimeException: Empty Optional cannot be unwrapped
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
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:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
at java.lang.Thread.run(Thread.java:762)
Im trying to implement this Facebook-SDK for React-Native.
I followed the steps in the README guide but cannot get it to Work.
Every time i try to log in with Facebook I get the following error message:
EDIT: Im running the a signed APK
EDIT2: The error does only happen with the signed APK - what could that mean?
undefined is not a function (evaluating '_reactNativeFacebookLogin.FBLoginManager.loginWithPermissions')
Unable to symbolicate stack trace: Bundle was not loaded from the packager
FATAL EXCEPTION: mqt_native_modules
Process: com.solopro.dogwood, PID: 5018
com.facebook.react.modules.core.JavascriptException: undefined is not a function (evaluating '_reactNativeFacebookLogin.FBLoginManager.loginWithPermi
ssions'), stack:
facebookLogin#76454:62
touchableHandlePress#52180:39
_performSideEffectsForTransition#21343:26
_receiveSignal#21259:38
touchableHandleResponderRelease#21033:20
invokeGuardedCallback#15044:12
executeDispatch#14877:38
executeDispatchesInOrder#14900:16
executeDispatchesAndRelease#14354:42
executeDispatchesAndReleaseTopLevel#14365:35
forEachAccumulated#15179:12
processEventQueue#14527:19
runEventQueueInBatch#15204:33
handleTopLevel#15215:21
<unknown>#14147:39
perform#16143:16
batchedUpdates#31745:20
batchedUpdates#15373:32
_receiveRootNodeIDEvent#14146:28
receiveTouches#14208:48
__callFunction#7706:28
<unknown>#7613:22
guard#7564:3
callFunctionReturnFlushedQueue#7612:6
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:90)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:78)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:319)
at com.facebook.react.bridge.NativeModuleRegistry$ModuleDefinition.call(NativeModuleRegistry.java:187)
at com.facebook.react.bridge.NativeModuleRegistry.call(NativeModuleRegistry.java:62)
at com.facebook.react.bridge.CatalystInstanceImpl$NativeModulesReactCallback.call(CatalystInstanceImpl.java:432)
at com.facebook.react.bridge.queue.NativeRunnableDeprecated.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
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:135)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:193)
at java.lang.Thread.run(Thread.java:818)
Maybe this is even a known issue.
UPDATE:
The error is pointing out the function "loginWithPermissions" which is not even available in the android package of react-native-fbsdk but only in the iOS package.
I have no idea why this function is being used.
I am using LoginManager.logInWithReadPermissions(['public_profile', 'email']).then(...) for the FB-Login
Most likely the questioner had overcome this issue.
Sometimes, if some Facebook libraries (like fbjs/lib/invariant) are used in development process, the related lines must be marked as comment line before building the release apk.
I have added one React Native screen to my existing android project.
Copying the proguard settings related to react native from
https://github.com/facebook/react-native/blob/master/local-cli/generator-android/templates/src/app/proguard-rules.pro WORKS.
However I want to enable obfuscation for my project and hence commented out the line -dontobfuscate
After this, when I deploy the release build in my nexus device, I get this error :
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: com.sampleapp, PID: 2463
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/app/com.sampleapp-1/base.apk)
at com.facebook.react.modules.netinfo.NetInfoModule.<init>(NetInfoModule.java:55)
at com.facebook.react.shell.MainReactPackage.createNativeModules(MainReactPackage.java:67)
at com.facebook.react.ReactInstanceManagerImpl.processPackage(ReactInstanceManagerImpl.java:793)
at com.facebook.react.ReactInstanceManagerImpl.createReactContext(ReactInstanceManagerImpl.java:730)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:5091)
at com.facebook.react.ReactInstanceManagerImpl$ReactContextInitAsyncTask.doInBackground(ReactInstanceManagerImpl.java:169)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
This link does mention obfuscation isn't supported in React-Native:
https://github.com/facebook/react-native/issues/7530
I want to obfuscate existing app code.