Xamarin Forms App Crash on Startup with One Plus 5t - nullpointerexception

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

Related

Android KeyStore crashes in Android Instant App

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 !

Error while Debugging application on Windows OS or Android

I'am having a problem with JS Debugger on Windows or Android, when I debug the app crashes. Every time I try to reopen it, the app crashes. This is my log cat:
2019-02-04 12:48:27.135 26780-26833/com.cmcj E/AndroidRuntime: FATAL EXCEPTION: mqt_js
Process: com.cmcj, PID: 26780
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp;
at io.invertase.firebase.RNFirebaseModule.getConstants(RNFirebaseModule.java:158)
at com.facebook.react.bridge.JavaModuleWrapper.getConstants(JavaModuleWrapper.java:138)
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:29)
at android.os.Looper.loop(Looper.java:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.FirebaseApp" on path: DexPathList[[zip file "/data/app/com.cmcj-1/base.apk"],nativeLibraryDirectories=[/data/app/com.cmcj-1/lib/arm, /data/app/com.cmcj-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at io.invertase.firebase.RNFirebaseModule.getConstants(RNFirebaseModule.java:158) 
at com.facebook.react.bridge.JavaModuleWrapper.getConstants(JavaModuleWrapper.java:138) 
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:29) 
at android.os.Looper.loop(Looper.java:154) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192) 
at java.lang.Thread.run(Thread.java:761) 
It does look like the linking went wrong after linking firebase. You need to make sure that everything is in place in MainApplication (especially the namespaces from where classes are taken).

React Native Android - "Could not get BatchedBridge, make sure your bundle is packaged properly"

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) 

React-Native: _reactNativeFacebookLogin.FBLoginManager.loginWithPermissions is undefined

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.

Actionbarsherlock Main SherlockFragmentActivity ClassNotFoundException

I have added Actionbarsherlock 4.3.1 to an existing project in IntelliJ. With some dificulties to begin with. There are no errors and the app compiles, but i am getting a runtime error on startup and the app crashes.
My Main Screen now extends SherlockFragmentActivity, before ABS i had FragmentActivity and everything was working fine. I changed all the Fragments to SherlockFragments and am getting no errors as mentioned. this is my error log. What am i missing?
07-08 13:31:37.363: ERROR/AndroidRuntime(1352): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.adix.Gesetze/com.adix.Gesetze.MainScreen}: java.lang.ClassNotFoundException: com.adix.Gesetze.MainScreen
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2024)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.adix.Gesetze.MainScreen
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
Am happy to provide additional info if needed.
I resolved it by changing the scope of the support library to compile. I had it on provide when i was trying arround with a other issue i had with ABS 4.3.1