Debug android app termination - android

I am currently implementing my first Android app. Debugging and developing goes usually fine but sometimes I have problem when doing some changes in my code and then starting the app again from Eclipse environment (to virtual device).
As far as I understand it, new start terminates the currently running version of my app in the emulator, that's fine - but is this some correct termination? Is some event raised in my app which I should handle?
Why am I asking? My problem is that for most of the Activities being currently active in the emulator my app terminates (it's gone) correctly and new version starts fine. But for about 2 of my Activities when they are active and I "restart" my app from Eclipse I can see for a few seconds message box "Unfortunately APP has stopped" and that gives me an idea that these Activities have probably to do something in their destructor, uninitialize something or whatever because termination causes some kind of crash. How to detect this, how to debug this? When I start the app again, the old version debugger is disconnected so it's not helping. All I can see is logcat exception call stack info but it's not helping me too much:
01-19 11:19:16.352: E/AndroidRuntime(1424): FATAL EXCEPTION: main
01-19 11:19:16.352: E/AndroidRuntime(1424): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread.access$1300(ActivityThread.java:141)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.os.Handler.dispatchMessage(Handler.java:99)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.os.Looper.loop(Looper.java:137)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.ActivityThread.main(ActivityThread.java:5039)
01-19 11:19:16.352: E/AndroidRuntime(1424): at java.lang.reflect.Method.invokeNative(Native Method)
01-19 11:19:16.352: E/AndroidRuntime(1424): at java.lang.reflect.Method.invoke(Method.java:511)
01-19 11:19:16.352: E/AndroidRuntime(1424): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-19 11:19:16.352: E/AndroidRuntime(1424): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-19 11:19:16.352: E/AndroidRuntime(1424): at dalvik.system.NativeStart.main(Native Method)
01-19 11:19:16.352: E/AndroidRuntime(1424): Caused by: java.lang.NullPointerException
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:379)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.getClassLoader(LoadedApk.java:322)
01-19 11:19:16.352: E/AndroidRuntime(1424): at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
01-19 11:19:16.352: E/AndroidRuntime(1424): ... 11 more

Debugger problem, app terminated in bad way, not real issue.

Related

Crashlytics NoClassDefFoundError: com.crashlytics.android.answers.Answers

I get a project from other developer to fix minor issues in app, when I'm running my app on device I'm getting an error:
15142-15142/com.etripconcept E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.crashlytics.android.answers.Answers
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:224)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:207)
at com.crashlytics.android.Crashlytics.<init>(Crashlytics.java:202)
at com.etripconcept.SplashScreenActivity.onCreate(SplashScreenActivity.java:16)
at android.app.Activity.performCreate(Activity.java:5163)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4895)
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:994)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
at dalvik.system.NativeStart.main(Native Method)
I'm new in Android development, so it may be stupid question, but Google doesn't say anything about it. I use Android Studio 1.2.2 on Win 8.1

java.lang.VeriryError encountered

Deat developers.
I have made an application but i encounter the following problem:
Occasionally (not always - some times) i get the following error:
java.lang.VerifyError: com/google/example/games/basegameutils/GameHelper
at com.google.example.games.basegameutils.BaseGameActivity.onCreate(BaseGameActivity.java:103)
at development.nk.games.tanc.MainActivity.onCreate(MainActivity.java:97)
at android.app.Activity.performCreate(Activity.java:5047)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
at android.app.ActivityThread.access$700(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
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:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
I have looked after this problem and i read that i have to check all Libraries. I did that but the problem still is there.
The class "GameHelper" is a helper class that i use from google play services.
"MainActivity" is the main Activity my app runs. "MainActivity" extends "BaseGameActivity" which uses the "GameHelper" class.
Thank you in advance.

Unable to start activity On Sony Experia S

I recently published my app to the android play store.
I see a whole lot of error logs from one device in particular. It's a Sony Experia S.
I contacted the owner of the device, and he says he has the latest version of android ( don't know the exact version ).
I heard from a colluege developer that there are more known issieus with sony devices and android.
This app in particular works with fragments... Don't know if this is the problem but... Maybe the sony's don't know how to cope with them.
Does anyone have an idea what this problem could be.
Error logs looks like:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crosscommunications.kvodeventer/com.crosscommunications.kvodeventer.KVODeventerActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crosscommunications.kvodeventer/com.crosscommunications.kvodeventer.TabControllerHome}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4511)
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:980)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crosscommunications.kvodeventer/com.crosscommunications.kvodeventer.TabControllerHome}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
at android.app.ActivityThread.startActivityNow(ActivityThread.java:1808)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:682)
at android.widget.TabHost.setCurrentTab(TabHost.java:346)
at android.widget.TabHost.addTab(TabHost.java:236)
at com.crosscommunications.kvodeventer.KVODeventerActivity.onCreate(KVODeventerActivity.java:27)
at android.app.Activity.performCreate(Activity.java:4470)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
... 11 more
Caused by: java.lang.NullPointerException
at com.crosscommunications.kvodeventer.KVOHome.onCreateView(KVOHome.java:52)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:870)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:505)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1136)
at android.app.Activity.performStart(Activity.java:4480)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1940)
... 21 more
Thnx
Just put a null check to your code:
KVOHome Acvitivity, line 52.
at com.crosscommunications.kvodeventer.KVOHome.onCreateView(KVOHome.java:52)
Most probably, Sony sends a null value to your code.

Android Smack chat client

Hi freinds I an using Smack3.2.1.jar downloaded from following url
http://www.igniterealtime.org/downloads/index.jsp
I added jar to my buildpath But when I run the application I get the following Error log
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): FATAL EXCEPTION: main
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): java.lang.VerifyError: org.jivesoftware.smack.sasl.SASLMechanism
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at java.lang.Class.getDeclaredConstructors(Native Method)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at java.lang.Class.getConstructor(Class.java:477)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:314)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at org.jivesoftware.smack.Connection.login(Connection.java:348)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at org.apache.android.xmpp.SettingsDialog.onClick(SettingsDialog.java:54)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at android.view.View.performClick(View.java:2408)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at android.view.View$PerformClick.run(View.java:8816)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at android.os.Handler.handleCallback(Handler.java:587)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at android.os.Handler.dispatchMessage(Handler.java:92)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at android.os.Looper.loop(Looper.java:123)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at android.app.ActivityThread.main(ActivityThread.java:4627)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at java.lang.reflect.Method.invokeNative(Native Method)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at java.lang.reflect.Method.invoke(Method.java:521)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
10-12 13:11:59.464: ERROR/AndroidRuntime(1957): at dalvik.system.NativeStart.main(Native Method)
Can anyone help ...
Smack doesn't work on android out of the box, you may want to use aSmack (http://code.google.com/p/asmack/) which is a port of smack for Android.
Finally I got the Concrete implementation
Anyone who want to develop chat client then follow the steps mentioned below.
Go to link
http://www.beem-project.com/projects/beem/files
Download
asmack-android-7-source-beem.zip
Now modify this source as per your requirement.
You will find the lib asmack-android-7-beem.jar to obtain javadoc for this lib its same as javadoc for smack what i did is as follows.
Download source smack-3.2.1 from link below
http://www.igniterealtime.org/downloads/index.jsp
When you extract the jar you will get the folder named javadoc now just attach this folder to asmack-android-7-beem.jar by going to the properties of your project.
Hip Hip Hurray....
You can't use vanilla Smack prior Smack 4 on Android. Have a look at "Android and XMPP: Currently available solutions"
use dependencies inject this in your build.gradle
compile 'org.igniterealtime.smack:smack-android:4.1.6'
compile 'org.igniterealtime.smack:smack-tcp:4.1.6'
compile 'org.igniterealtime.smack:smack-im:4.1.6'
compile 'org.igniterealtime.smack:smack-extensions:4.1.6'

Android Tab Layout 2.1

Hi all I have looked at the tutorial for creating tab layout on android on here:
link
which didn't work so I looked on here to find that there where errors with it. So I applied these and still I'm not getting anywhere with it.
The app loads on 2.1 emulator on eclipse and also on my phone but the application force closes each time which leads me to think that its a manifest problem.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Android.fitnessap"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".TabLayout"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeActivity"/>
<activity android:name=".HistoryActivity"/>
<activity android:name=".SettingsActivity"/>
</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>
I've been stuck on this for hours now.
Thanks.
edit logcat:
01-19 18:37:09.316: ERROR/AndroidRuntime(126): ERROR: thread attach failed
01-19 18:37:10.945: ERROR/MediaPlayerService(31): Couldn't open fd for content://settings/system/notification_sound
01-19 18:37:10.955: ERROR/MediaPlayer(52): Unable to to create media player
01-19 18:37:15.345: ERROR/AndroidRuntime(170): ERROR: thread attach failed
01-19 18:37:17.215: ERROR/AndroidRuntime(197): Uncaught handler: thread main exiting due to uncaught exception
01-19 18:37:17.315: ERROR/AndroidRuntime(197): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.Android.fitnessap/com.Android.fitnessap.TabLayout}: java.lang.ClassNotFoundException: com.Android.fitnessap.TabLayout in loader dalvik.system.PathClassLoader#43b868e0
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.os.Handler.dispatchMessage(Handler.java:99)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.os.Looper.loop(Looper.java:123)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.reflect.Method.invokeNative(Native Method)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.reflect.Method.invoke(Method.java:521)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at dalvik.system.NativeStart.main(Native Method)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): Caused by: java.lang.ClassNotFoundException: com.Android.fitnessap.TabLayout in loader dalvik.system.PathClassLoader#43b868e0
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): ... 11 more
01-19 18:37:17.375: ERROR/dalvikvm(197): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
for a template on tabview that will work out of the box. Your manifest seems ok (but I'm not that good at android yet), so I would suggest using logcat to figure out what's up. In Eclipse, Window > Show View > Other.. and Under Android select logcat. Now run your app again and watch the ouptut of logcat for errors. It is a very good way to debug your app, just look for red exceptions and follow the ones related to your source code.

Categories

Resources