xyz xyz - 3 months ago 9
Java Question

Android app crashing randomly(java.lang.NoClassDefFoundError)

My app is constantly communicating with the network and it runs perfectly when I launch it first time.
But after sometime when I go minimize the app or switch between different apps and then when I open my app its getting crash.
Here is the log:


10-19 16:53:12.872: E/AndroidRuntime(15318): Process: com.aleph.view, PID: 15318

10-19 16:53:12.872: E/AndroidRuntime(15318): java.lang.NoClassDefFoundError: com.aleph.model.MessageTypes

10-19 16:53:12.872: E/AndroidRuntime(15318): at com.al+nuListActivity.prepareURL(MainMenuListActivity.java:435)

10-19 16:53:12.872: E/AndroidRuntime(15318): at com.aleph.view.abstractActivity.TemplateListActivity.processThread(TemplateListActivity.java:148)

10-19 16:53:12.872: E/AndroidRuntime(15318): at
com.aleph.controller.MainMenuAction.ListItemClick(MainMenuAction.java:168)

10-19 16:53:12.872: E/AndroidRuntime(15318): at com.aleph.view.myTrip.MainMenuListActivity.onListItemClick(MainMenuListActivity.java:109)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.app.ListActivity$2.onItemClick(ListActivity.java:319)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.widget.AdapterView.performItemClick(AdapterView.java:300)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.widget.AbsListView.performItemClick(AbsListView.java:1186)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.widget.AbsListView$PerformClick.run(AbsListView.java:3099)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.widget.AbsListView$3.run(AbsListView.java:4046)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.os.Handler.handleCallback(Handler.java:739)

10-19 16:53:12.872: E/AndroidRuntime(15318): at android.os.Handler.dispatchMessage(Handler.java:95)

10-19 16:53:12.872: E/AndroidRuntime(15318): at
android.os.Looper.loop(Looper.java:135)

10-19 16:53:12.872: E/AndroidRuntime(15318): at
android.app.ActivityThread.main(ActivityThread.java:5376)

10-19 16:53:12.872: E/AndroidRuntime(15318): at java.lang.reflect.Method.invoke(Native Method)
10-19 16:53:12.872: E/AndroidRuntime(15318): at java.lang.reflect.Method.invoke(Method.java:372)

10-19 16:53:12.872:E/AndroidRuntime(15318): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)

10-19 16:53:12.872: E/AndroidRuntime(15318): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)


Followed by:


10-19 16:54:08.802: E/AndroidRuntime(16425): Process: com.aleph.view,
PID: 16425

10-19 16:54:08.802: E/AndroidRuntime(16425): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.aleph.view/com.aleph.view.myTrip.LoginActivity}:
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String java.lang.String.trim()' on a null object reference

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2345)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.ActivityThread.access$800(ActivityThread.java:155)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1323)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.os.Handler.dispatchMessage(Handler.java:102)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.os.Looper.loop(Looper.java:135)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.ActivityThread.main(ActivityThread.java:5376)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
java.lang.reflect.Method.invoke(Native Method)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
java.lang.reflect.Method.invoke(Method.java:372)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

10-19 16:54:08.802: E/AndroidRuntime(16425): Caused by:
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String java.lang.String.trim()' on a null object reference

10-19 16:54:08.802: E/AndroidRuntime(16425): at com.aleph.model.phoneHome.PhoneHomeValidator.checkMobileData(PhoneHomeValidator.java:124)

10-19 16:54:08.802: E/AndroidRuntime(16425): at com.aleph.model.phoneHome.PhoneHomeValidator.primeMobileForValidation(PhoneHomeValidator.java:54)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
com.aleph.view.myTrip.LoginActivity.onCreate(LoginActivity.java:70)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.Activity.performCreate(Activity.java:6021)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)

10-19 16:54:08.802: E/AndroidRuntime(16425): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)

10-19 16:54:08.802: E/AndroidRuntime(16425): ... 10 more


trying to solve this since long time. please help

Max Max
Answer

Things to do:

• Add the following lines to your proguard config file (usually called proguard-android.txt or proguard-rules.pro):

-keep class MessageTypes

-keep class com.aleph.model.MessageTypes

• Refresh your build

• Build the app again

Let me know if this worked, if not, I'll look further into it.

Comments