I had copy and edit the codes according to the answer from this post. But when I run the simulator, I got a runtime error saying "Unfortunately App Has Stopped". However, my logcat is showing a different error from the post.
I had tried clean project/rebuilt project/invalidate cache but still can't get the app to work.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.myapplication4/com.app.myapplication4.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.app.myapplication4.MainActivity.onCreate(MainActivity.java:56)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Line 56 of my code is:
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
My machine have jdk 7, Android Studio 1.0.2, Android Support Library 21.0.3, Android Support Repository 11 and my AVD is running on API level 16 x86.
Related
I updated Android Studio to 3.0.0 and Gradle to 3.0.0
After run my app on emulator Genymotion (API 16-19) crashed.
Error:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at android.support.v4.app.SupportActivity.<init>(SupportActivity.java:68)
at android.support.v4.app.BaseFragmentActivityGingerbread.<init>(BaseFragmentActivityGingerbread.java:37)
at android.support.v4.app.BaseFragmentActivityHoneycomb.<init>(BaseFragmentActivityHoneycomb.java:29)
at android.support.v4.app.BaseFragmentActivityJB.<init>(BaseFragmentActivityJB.java:30)
at android.support.v4.app.FragmentActivity.<init>(FragmentActivity.java:79)
at android.support.v7.app.AppCompatActivity.<init>(AppCompatActivity.java:61)
at com.myapp.start.BaseActivity.<init>(BaseActivity.java:37)
at com.myapp.start.StartActivity.<init>(StartActivity.java:40)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1098]: Library '/system/lib/libhoudini.so' not found
Native methods in my app not using. What could be the problem?
Check your advanced profiling Run-->Edit Configurations.. --> Profiling Tab
--> Uncheck (Enable advanced profiling)
This question already has an answer here:
Android App is crashing when connecting to Firebase
(1 answer)
Closed 7 years ago.
this the logcat message
FATAL EXCEPTION: main
java.lang.IllegalAccessError: tried to access method java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy:()V from class com.firebase.client.utilities.DefaultRunLoop
at com.firebase.client.utilities.DefaultRunLoop.<init>(DefaultRunLoop.java:45)
at com.firebase.client.android.AndroidPlatform$1.<init>(AndroidPlatform.java:44)
at com.firebase.client.android.AndroidPlatform.newRunLoop(AndroidPlatform.java:44)
at com.firebase.client.core.Context.ensureRunLoop(Context.java:224)
at com.firebase.client.core.Context.initServices(Context.java:111)
at com.firebase.client.core.Context.freeze(Context.java:92)
at com.firebase.client.core.RepoManager.getLocalRepo(RepoManager.java:55)
at com.firebase.client.core.RepoManager.getRepo(RepoManager.java:19)
at com.firebase.client.Firebase.<init>(Firebase.java:172)
at com.firebase.client.Firebase.<init>(Firebase.java:177)
at com.firebase.client.Firebase.<init>(Firebase.java:155)
at elnagga.forebasedemo.MainActivity.onCreate(MainActivity.java:24)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Take a look at Android App is crashing when connecting to Firebase. This appears to be a bug in the firebase android client. To avoid this Error use firebase android client version 2.5.0 instead of 2.5.1 which I assume you are using now.
I have this error when using it on pre-lollipop devices
Is there anyway to use android.telephony.SubscriptionManager on pre-lollipop devices?
java.lang.NoClassDefFoundError: android.telephony.SubscriptionManager
at naviramyle.stkplus.utils.SendSMS.init(SendSMS.java:40)
at naviramyle.stkplus.activities.MainActivity.onCreate(MainActivity.java:95)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Facebook apk delivered with sdk 4.1.0 doesn't not work in emulators where it supposed to work(sdk emulator and genymotion)
It always crashes with the same exception
05-08 08:42:42.022 3279-3279/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: could find DSO to load: libbreakpad.so
at com.facebook.soloader.SoLoader.a(SoLoader.java:179)
at com.facebook.soloader.SoLoader.a(SoLoader.java:144)
at com.facebook.breakpad.BreakpadManager.a(BreakpadManager.java:55)
at com.facebook.breakpad.BreakpadManager.b(BreakpadManager.java:78)
at com.facebook.breakpad.BreakpadManager.a(BreakpadManager.java:82)
at com.facebook.katana.app.FacebookApplication.b(FacebookApplication.java:169)
at com.facebook.base.app.DelegatingApplication.attachBaseContext(DelegatingApplication.java:62)
at android.app.Application.attach(Application.java:146)
at android.app.Instrumentation.newApplication(Instrumentation.java:983)
at android.app.Instrumentation.newApplication(Instrumentation.java:967)
at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Any solution?
Change your avd image from x86 to Arm.
It should work with you now.
I've got a Maven project that I'm trying to use Volley with. This is my first time using either. I added Volley to my local repository, and I added the dependency in my project's pom.xml file. Everything compiles nicely, but whenever I try to make a new Request object, I get a NullPointerException on the super class Request object. Any help?
EDIT: Here's my stack trace
8-29 22:14:58.830: ERROR/AndroidRuntime(696): FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lhs.app/com.lhs.app.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.android.volley.Request.<init>(Request.java:129)
at com.android.volley.toolbox.JsonRequest.<init>(JsonRequest.java:58)
at com.android.volley.toolbox.JsonObjectRequest.<init>(JsonObjectRequest.java:47)
at com.lhs.app.MainActivity.startRequest(MainActivity.java:35)
at com.lhs.app.MainActivity.onCreate(MainActivity.java:26)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
Provided I have the same version of Volley, the NPE happens in this line:
mDefaultTrafficStatsTag = TextUtils.isEmpty(url) ? 0: Uri.parse(url).getHost().hashCode();
So it seems you are using an url without a host part.