1

I have built an Android app that until updating the Android API, from 19 to 21, ran successfully. Now when I run the app, the login page does appear, but just as a user logs in and starts the MainActivity, the app crashes stating 'App has stopped', while the error is thrown:

12-11 17:46:21.411: E/ActivityThread(12327): Pause GC
12-11 17:46:21.411: E/ActivityThread(12327): java.lang.reflect.InvocationTargetException
12-11 17:46:21.411: E/ActivityThread(12327):    at java.lang.reflect.Method.invokeNative(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327):    at java.lang.reflect.Method.invoke(Method.java:515)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.app.ActivityThread.pauseGC(ActivityThread.java:5410)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2277)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.app.ActivityThread.access$900(ActivityThread.java:169)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.os.Handler.dispatchMessage(Handler.java:102)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.os.Looper.loop(Looper.java:146)
12-11 17:46:21.411: E/ActivityThread(12327):    at android.app.ActivityThread.main(ActivityThread.java:5487)
12-11 17:46:21.411: E/ActivityThread(12327):    at java.lang.reflect.Method.invokeNative(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327):    at java.lang.reflect.Method.invoke(Method.java:515)
12-11 17:46:21.411: E/ActivityThread(12327):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
12-11 17:46:21.411: E/ActivityThread(12327):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
12-11 17:46:21.411: E/ActivityThread(12327):    at dalvik.system.NativeStart.main(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327): Caused by: java.lang.UnsatisfiedLinkError: Native method not found: dalvik.system.VMRuntime.pauseGc:(Ljava/lang/String;)I
12-11 17:46:21.411: E/ActivityThread(12327):    at dalvik.system.VMRuntime.pauseGc(Native Method)
12-11 17:46:21.411: E/ActivityThread(12327):    ... 15 more
12-11 17:46:21.446: D/AndroidRuntime(12327): Shutting down VM
12-11 17:46:21.446: W/dalvikvm(12327): threadid=1: thread exiting with uncaught exception (group=0x41daec08)
12-11 17:46:21.451: E/AndroidRuntime(12327): FATAL EXCEPTION: main
12-11 17:46:21.451: E/AndroidRuntime(12327): Process: com.example.feastapp, PID: 12327
12-11 17:46:21.451: E/AndroidRuntime(12327): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.feastapp/com.example.feastapp.MainActivity}: java.lang.NullPointerException
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.ActivityThread.access$900(ActivityThread.java:169)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.os.Handler.dispatchMessage(Handler.java:102)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.os.Looper.loop(Looper.java:146)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.ActivityThread.main(ActivityThread.java:5487)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at java.lang.reflect.Method.invokeNative(Native Method)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at java.lang.reflect.Method.invoke(Method.java:515)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at dalvik.system.NativeStart.main(Native Method)
12-11 17:46:21.451: E/AndroidRuntime(12327): Caused by: java.lang.NullPointerException
12-11 17:46:21.451: E/AndroidRuntime(12327):    at com.example.feastapp.MainActivity.onCreate(MainActivity.java:77)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.Activity.performCreate(Activity.java:5451)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
12-11 17:46:21.451: E/AndroidRuntime(12327):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
12-11 17:46:21.451: E/AndroidRuntime(12327):    ... 11 more

This is a very perplexing situation as just before the update, the app ran just fine. Absolutely no changes were made to the code. At present, the login page can appear but when entering credentials and pressing send the app crashes immediately. Any Idea on how to alleviate?

Sauron
  • 6,399
  • 14
  • 71
  • 136
  • Can you post your MainActivity? Something on line 77 is null. – Austin Musice Dec 12 '14 at 00:07
  • @warl0ck08 Yes, I was updating to API 21 from API 19 and it turns out nearly all the ActionBar methods I have used are deprecated, thus many are NULL upon execution. Do you know of a location to source the `android-support-v4` and `android-support-v4-appcompat` libraries for API 19? – Sauron Dec 12 '14 at 00:10
  • The support libraries still support 19. You can just change the method name. Assuming this is due to getActionBar(). You should just be able to change it to getSupportActionBar() and continue going. – Austin Musice Dec 12 '14 at 00:30
  • No, .setNavigationMode, is depracated, the one I need – Sauron Dec 12 '14 at 00:32
  • Yikes! Yeah, I would have avoided using that in general. What mode are you using? – Austin Musice Dec 12 '14 at 00:37
  • Needed to use NAVIGATION_MODE_LIST – Sauron Dec 12 '14 at 00:38
  • I need to make a tab layout with a listview, do you know how to do that? – Sauron Dec 12 '14 at 00:38
  • I would move to the new common navigation patterns. So option 1 would be using a NavigationDrawer, and option 2 would be using a TabHost, ViewPager, etc. The whole list drop down navigation has been done as far as design patterns go for a while. – Austin Musice Dec 12 '14 at 00:40

0 Answers0