I do have a curious error in my application.
My app crashes (don’t mind the crash, I roughly know why – classloader) when I start the application from the OS directly, then kill it from the background via any Task Killer (this is one of the few ways to reproduce the crash consistently -> simulating the OS freeing memory and closing the application) and try to restart it again.
The thing is, if I start the application via adb shell using the following command:
adb shell am start -a android.intent.action.MAIN -n com.my.packagename/myLaunchActivity
I cannot reproduce the crash.
So is there any difference in how Android OS calls the application as opposed to the above call?
EDIT: added the manifest (just changed names)
<?xml version="1.0" ?>
<manifest android:versionCode="5" android:versionName="1.05" package="com.my.sample" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="7"/>
<application android:icon="@drawable/square_my_logo" android:label="@string/app_name">
<activity android:label="@string/app_name" android:name="com.my.InfoActivity" android:screenOrientation="landscape"></activity>
<activity android:label="@string/app_name" android:name="com.my2.KickStart" android:screenOrientation="landscape"/>
<activity android:label="@string/app_name" android:name="com.my2.Launcher" android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/></manifest>
starting the com.my2.Launcher from the adb shell
First thing I can see is that if you launch the app from the launcher icon, the Intent includes the CATEGORY “android.intent.category.LAUNCHER” and using the
adb shell amit does not.Also, when you launch via the launcher icon, the Intent flag
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED(0x200000) is set, in theadb shellcase it is not.Not sure if any of that would make a difference in your crash behaviour, but it answers the question.