The splash activity of my app works well on all devices except on an Android 10 device that I have just recently updated.
Here is my code:
public class SplashScreen extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(FirebaseAuth.getInstance().getUid() != null)
startActivity(new Intent(this, HomeActivity.class));
else
startActivity(new Intent(this, LoginActivity.class));
finish();
}
}
I have also tried navigating directly to HomeActiviy or LoginActivity but still crashes when I try to run on an Android 10 device
Error occurs when calling super.onCreate(savedInstanceState)
2020-01-17 13:58:25.527 23561-23561/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: rickroydaban.projects.android.memorise, PID: 23561
java.lang.RuntimeException: Unable to start activity ComponentInfo{rickroydaban.projects.android.memorise/rickroydaban.android.memorise.ui.SplashScreen}: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.lifecycle.ReportFragment.setProcessListener(androidx.lifecycle.ReportFragment$ActivityInitializationListener)' 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:7811)
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:1076)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.lifecycle.ReportFragment.setProcessListener(androidx.lifecycle.ReportFragment$ActivityInitializationListener)' on a null object reference
at androidx.lifecycle.ProcessLifecycleOwner$3.onActivityCreated(ProcessLifecycleOwner.java:162)
at android.app.Application.dispatchActivityCreated(Application.java:392)
at android.app.Activity.dispatchActivityCreated(Activity.java:1232)
at android.app.Activity.onCreate(Activity.java:1513)
at androidx.core.app.ComponentActivity.onCreate(ComponentActivity.java:81)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:149)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:313)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106)
at rickroydaban.android.memorise.ui.SplashScreen.onCreate(SplashScreen.java:18)
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:7811)
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:1076)
Has anyone able to fix this issue?
As per this issue, this will occur when using lifecycle-runtime:2.2.0 (usually through a transitive dependency on Fragment or AppCompat) and lifecycle-process:2.1.0 (usually through a transitive dependency on lifecycle-extensions).
There are a number of work arounds available in the bug:
You do any one of the following:
Add an explicit dependency on lifecycle-process:2.2.0-alpha05 to pull in the new version that is compatible with lifecycle-runtime:2.2.0-alpha05
Upgrade your lifecycle:extensions dependency to 2.2.0-alpha05 so that lifecycle-process is upgraded
Remove the lifecycle:extensions dependency entirely and use only the lifecycle libraries you need (for example, use lifecycle-viewmodel-ktx if you want ViewModels) so that you don't pull in lifecycle-process at all
Or, since the compatibility issue has been fixed in a later release, upgrade to a later version of Fragments (version 1.2.0-beta01 or higher) or Lifecycle 2.2.0-beta01 or higher if you directly depend on Lifecycle.
Related
I've developed a KivyMD app which runs fine on my Windows machine. However, my company has locked down all my USB ports, so I'm not able to "deploy" the app for testing with Buildozer. Instead, I'm using Android Studio to emulate Android. I'm able to install my APK file (produced with Buildozer) on the virtual device, but when I launch the app I only see a Kivy splash screen which says "Loading..." for a second and then it crashes.
Android Studio provides the following log, but as far as I can tell it offers no clue to what the problem is.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.facefinder, PID: 3493
java.lang.RuntimeException: Unable to resume activity {com.example.facefinder/com.example.facefinder.MainActivity}:
java.lang.NullPointerException: Attempt to get length of null array
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4205)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4237)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to get length of null array
at com.example.facefinder.MainActivity.onResume(MainActivity.java:81)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1446)
at android.app.Activity.performResume(Activity.java:7939)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4195)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4237)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
What can I do to diagnose my problem? Thanks in advance for any guidance!
I am making this post today because I have a problem with my ionic application.
So here it is, the app builds perfectly on an emulator with android studio. However, right after the splash screen it crashes instantly. I have no idea why this is happening. After running the app in debug mode, I get this error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.julesbsz.shortnews, PID: 862
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.julesbsz.shortnews/com.julesbsz.shortnews.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
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:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:47)
at com.getcapacitor.PluginHandle.load(PluginHandle.java:72)
at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:44)
at com.getcapacitor.Bridge.registerPlugin(Bridge.java:476)
at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:440)
at com.getcapacitor.Bridge.<init>(Bridge.java:170)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:83)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:62)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:48)
at com.julesbsz.shortnews.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
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:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
I really don't see what the problem is. Also, if you need more information about something in particular, let me know. Thank you very much.
If you read the stacktrace you can see that the crash originates from
at com.julesbsz.shortnews.MainActivity.onCreate(MainActivity.java:17)
It then appears to fail at some authorization logic
at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:47)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
You did not post your code so perhaps this is a good time to learn how to set breakpoints and debug?
https://developer.android.com/studio/debug#breakPoints
native ad mobile opened. This error is causing this error for me. I tried to fix this error several times but I could not fix it. Native ad is causing this error.
Error
*E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 19618
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.ads.AdView.setAdSize(com.google.android.gms.ads.AdSize)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3318)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3429)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.ads.AdView.setAdSize(com.google.android.gms.ads.AdSize)' on a null object reference
at com.example.myapplication.MainActivity.loadBanner(MainActivity.java:59)
at com.example.myapplication.MainActivity.onCreate(MainActivity.java:38)
at android.app.Activity.performCreate(Activity.java:7343)
at android.app.Activity.performCreate(Activity.java:7333)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3271)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3429)
at android.app.ActivityThread.-wrap12(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
I/Process: Sending signal. PID: 19618 SIG: 9*
I guess you are using the Admob Adaptive Banner. If so, then you are probably missing an instance of AdView. Make sure that you have the following code in onCreateView and call loadBanner() function after the instance of AdView is created:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
adContainerView = findViewById(R.id.ad_view_container);
adView = new AdView(this);
adView.setAdUnitId(getString(R.string.adaptive_banner_ad_unit_id));
adContainerView.addView(adView);
loadBanner();
}
From The Official Document:
you want to use AdSize from com.google.android.gms.ads and it returns null. you can declare the size of BANNER, or
I recommend that you use Firebase - Ads.
I hope I have helped.
I have integrated google Admob and Firebase SDK in Android app. And the Ad is showing correctly with impressions shown in the Admob and Firebase consoles.
But upon clicking any of the Ads from the app, the app CRASHES.
Following are the build details
implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'
implementation 'com.google.android.gms:play-services-ads:19.2.0'
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.3'
implementation 'com.google.firebase:firebase-crashlytics:17.1.0'
implementation 'com.google.firebase:firebase-perf:19.0.7'
with build config
ANDROID_BUILD_TARGET_SDK_VERSION=29
ANDROID_BUILD_TOOLS_VERSION=29.0.3
ANDROID_BUILD_SDK_VERSION=29
ANDROID_BUILD_MIN_SDK_VERSION=16
And this is the stack trace.
2020-07-02 01:19:01.819 28965-28965/in.typecast.scan10 E/AndroidRuntime: FATAL EXCEPTION: main
Process: in.typecast.scan10, PID: 28965
java.lang.RuntimeException: Unable to start activity ComponentInfo{in.typecast.scan10/com.google.android.gms.ads.AdActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter bundle
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.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter bundle
at in.typecast.utils.ApplicationLifecycleManager.onActivityCreated(Unknown Source:7)
at android.app.Application.dispatchActivityCreated(Application.java:392)
at android.app.Activity.dispatchActivityCreated(Activity.java:1232)
at android.app.Activity.onCreate(Activity.java:1513)
at com.google.android.gms.ads.AdActivity.onCreate(com.google.android.gms:play-services-ads-lite##19.2.0:2)
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)
2020-07-02 01:19:02.193 28965-28965/in.typecast.scan10 I/Process: Sending signal. PID: 28965 SIG: 9
The issue was due to my code. The ApplicationLifecycleManager method params were not defined nullable.
The crash says:
Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter bundle
at in.typecast.utils.ApplicationLifecycleManager.onActivityCreated
Which means you've declared your parameter bundle as bundle: Bundle - it should be bundle: Bundle? - i.e., a nullable Bundle.
I'm getting the below error when running an opensource Flutter app that I checked out from Github. It runs the first Activity of the screen and after about 1-second app crashes with the following error in Logcat. I'm not able to see any errors in Run console of Flutter.
Process: app.ceylon.selftrackingapp, PID: 32590
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.ceylon.selftrackingapp/app.ceylon.selftrackingapp.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' 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:7811)
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:1076)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:116)
at com.baseflow.geolocator.GeolocatorPlugin.registerWith(GeolocatorPlugin.java:49)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:20)
at app.ceylon.selftrackingapp.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:7811)
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:1076)
2020-03-21 10:09:53.328 15534-15539/? E/nightwatch-watcher: Failed to read from logcat: Success
I'm using an actual device Galaxy S9+ for testing and here is the Flutter version that I have installed in my computer.
Flutter 1.15.17 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 2294d75bfa (2 weeks ago) • 2020-03-07 00:28:38 +0900
Engine • revision 5aff311948
Tools • Dart 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)
I've also looked for the solution and I've found one here.
The core is: add " flutter_plugin_android_lifecycle: ^1.0.4" to pubspec.yaml