I've recently come across a weird situation using the Android emulator. I started getting the infamous warning 'Something wrong here, didn't expect <package name> to be resumed'.
I have created a most basic Android project to test this. It seems the warning only appears in the emulator, but not on my Samsung Galaxy Android 1.6 device.
Unfortunately, at this time, I have no clue why this happens. I will try to get more info from the forums and post it here.
EDIT: I found the solution, please scroll to the end of the article to see the answer.
My scenario is as follows:
- Create simple Android project
- Sole and simple main activity MainActivity.java
public class MainActivity extends Activity
{
@Override
public void onConfigurationChanged(Configuration newConfig)
{
Log.d(TAG, "onConfigurationChanged");
super.onConfigurationChanged(newConfig);
}
@Override
public void onCreate(Bundle savedInstanceState)
{
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
}
@Override
protected void onPause()
{
Log.d(TAG, "onPause");
super.onPause();
}
@Override
protected void onResume()
{
Log.d(TAG, "onResume");
super.onResume();
}
String TAG = "ROT";
}
- AndroidManifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.rotation"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
- Install on emulator and rotate a few times (Numpad 7)
- Logcat output
53 PackageParser D Scanning package: /data/app/vmdl28266.tmp
53 PackageParser I test.rotation: compat added android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE
53 PackageManager I /data/app/vmdl28266.tmp changed; unpacking
32 installd D DexInv: --- BEGIN '/data/app/vmdl28266.tmp' ---
507 dalvikvm D DexOpt: load 37ms, verify 9ms, opt 2ms
32 installd D DexInv: --- END '/data/app/vmdl28266.tmp' (success) ---
32 installd I move /data/dalvik-cache/data@app@vmdl28266.tmp@classes.dex -> /data/dalvik-cache/data@app@test.rotation.a
pk@classes.dex
53 PackageManager D New package installed in /data/app/test.rotation.apk
501 AndroidRuntime D Shutting down VM
501 dalvikvm D DestroyJavaVM waiting for non-daemon threads to exit
501 dalvikvm D DestroyJavaVM shutting VM down
501 dalvikvm D HeapWorker thread shutting down
501 dalvikvm D HeapWorker thread has shut down
501 jdwp D JDWP shutting down net...
501 dalvikvm I Debugger has detached; object registry had 1 entries
501 dalvikvm D VM cleaning up
501 AndroidRuntime E ERROR: thread attach failed
501 dalvikvm D LinearAlloc 0x0 used 621260 of 5242880 (11%)
53 dalvikvm D GC freed 6097 objects / 401832 bytes in 201ms
53 ResourceType W Resources don't contain package for resource number 0x7f060000
53 ResourceType W Resources don't contain package for resource number 0x7f060001
512 AndroidRuntime D
512 AndroidRuntime D >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
512 AndroidRuntime D CheckJNI is ON
512 AndroidRuntime D --- registering native functions ---
512 ddm-heap D Got feature list request
53 ActivityManager I Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x1
0000000 cmp=test.rotation/.MainActivity }
512 AndroidRuntime D Shutting down VM
512 dalvikvm D DestroyJavaVM waiting for non-daemon threads to exit
512 dalvikvm D DestroyJavaVM shutting VM down
512 dalvikvm D HeapWorker thread shutting down
512 dalvikvm D HeapWorker thread has shut down
512 jdwp D JDWP shutting down net...
512 dalvikvm I Debugger has detached; object registry had 1 entries
512 dalvikvm D VM cleaning up
53 ActivityManager I Start proc test.rotation for activity test.rotation/.MainActivity: pid=518 uid=10037 gids={1015}
512 AndroidRuntime E ERROR: thread attach failed
512 dalvikvm D LinearAlloc 0x0 used 636716 of 5242880 (12%)
30 dalvikvm D GC freed 290 objects / 11064 bytes in 345ms
518 ddm-heap D Got feature list request
30 dalvikvm D GC freed 52 objects / 2288 bytes in 353ms
518 ROT D onCreate
518 ROT D onResume
30 dalvikvm D GC freed 2 objects / 56 bytes in 365ms
53 ActivityManager I Displayed activity test.rotation/.MainActivity: 1335 ms (total 1335 ms)
93 dalvikvm D GC freed 13515 objects / 683152 bytes in 115ms
53 WindowManager I Setting rotation to 1, animFlags=1
53 ActivityManager I Config changed: { scale=1.0 imsi=310/260 loc=de_DE touch=3 keys=2/1/1 nav=3/1 orien=2 layout=34}
518 ROT D onPause
518 ROT D onCreate
518 ROT D onResume
53 UsageStats W Something wrong here, didn't expect test.rotation to be resumed
53 ActivityManager I Config changed: { scale=1.0 imsi=310/260 loc=de_DE touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34}
53 dalvikvm D GC freed 3606 objects / 190280 bytes in 187ms
53 WindowManager I Setting rotation to 0, animFlags=0
518 ROT D onPause
53 UsageStats W Something wrong here, didn't expect test.rotation to be resumed
518 ROT D onCreate
518 ROT D onResume
53 ActivityManager I Config changed: { scale=1.0 imsi=310/260 loc=de_DE touch=3 keys=2/1/2 nav=3/1 orien=1 layout=34}
53 UsageStats W Something wrong here, didn't expect test.rotation to be resumed
518 ROT D onPause
518 ROT D onCreate
518 ROT D onResume
53 dalvikvm D GC freed 1820 objects / 91896 bytes in 94ms
518 ROT D onPause
236 dalvikvm D GC freed 119 objects / 4664 bytes in 80ms
- Colored logcat output screen shot

- On each rotation, this message appears: Something wrong here, didn't expect test.rotation to be resumed
- This rotation message does not appear on the Samsung Galaxy Android 1.6 device
- Emulator(Target Name = Android 2.0, Platform = 2.0, API level = 2.0) configuration is as follows in the picture below

- Link to project is here TestRotation.zip (40 KB)
EDIT: The gurus on the Google Android-Developers group have helped me with this issue. It seems there is nothing to worry about. I will copy/paste some answers.
Mark Murphy: The solution appears to be: ignore the message. Other apps, such as the built-in Launcher (home screen), Calculator, Contacts, and Music apps exhibit the same behavior.
Dianne Hackborn: Sorry yes the message is just some code in the system that gets out of sync (and at that point is fixing itself). It is nothing to worry about.
The link to the android-developers group post is this http://groups.google.com/group/android-developers/browse_thread/thread/9ead1c255898e099?hl=en
EDIT 2: If you are getting recurring "Something wrong here..." messages and your application keeps restarting then please check out the article at http://adrianvintu.com/blogengine/post/Force-Locale-on-Android.aspx
EDIT 3: You may also try this link for some more info http://stackoverflow.com/questions/2174865/something-wrong-here-didnt-expect-package-to-be-resumed-error-in-andorid-logc