The Infamous 'Something wrong here, didn't expect <package name> to be resumed' Warning

by adrian vintu 4/27/2010 1:16:00 PM

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");
    			// setContentView(R.layout.main);
    			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

Comparison of Android vs iPhone vs Nokia vs BlackBerry vs Windows Mobile 7

by adrian vintu 4/13/2010 8:29:00 PM

I have previously published an Android vs IPhone comparison and many people requested that I do a comparison of Android vs iPhone vs Nokia vs BlackBerry vs Windows Mobile 7. So here goes.

Android

  • open platform http://source.android.com
  • can compile custom firmwares - good for hackers and other
  • good framework, extended on each new firmware
  • supports multitasking
  • nice IDE - Eclipse, NetBeans
  • development SDK is free
  • easy to debug, can send logs to developers
  • programming language is Java but bridges from other languages exist (C# .net - Mono, etc)
  • Java is a high level language that appeared in 1995. Android supports Java 1.5 and translates the byte code to its own custom Dalvik byte code optimized for mobile devices.
  • for the hardcore programmers, Android offers the possibility of programming in C using the native dev kit NDK
  • can run script languages like LUA, Perl, Python, etc
  • can install third party applications from sdcard, random sites - not locked to a specific market
  • applications can hook and override everything - email interface, SMS sending, custom keyboards, etc
  • supports widgets
  • can publish applications on the Android market instantly - initial one time registration fee is 25E
  • user has access to the sdcard and can use it as a USB disk
  • no Adobe Flash support yet. Probably will be available in Q2 of this year.

iPhone

  • closed platform
  • no multitasking except for some Apple applications. multitasking is probably going to be introduced in the next vertion of the iPhone, the iPhone 4
  • development kit costs ~90E
  • More...

Nokia 6131 NFC and 6212 NFC crash and reset the phone

by adrian vintu 4/12/2010 7:15:00 PM

I found a very annoying "bug" on the Nokia 6212 NFC and Nokia 6131 NFC.

I was building an obfuscated MIDlet when all of a sudden it started crashing on the NFC phones mentioned above. The 6212 and 6131 were crashing before starting the application, so it got me thinking that it might be a verification issue.The crash was followed by a warm reset of the phone and after 4 consecutive crashes by a cold reset of the phone.

I tested in the emulator and everything was fine. I tested on other phones and again, no problem.

I tried to exclude classes from the build that I thought were not verified correctly but I had to give up because of the huge number of classes ~approx 500.

I removed the code requiring permissions and signed the MIDlet. Still no luck.

I started looking at the SVN, since I knew the application was previously working. I noticed something. The icon.png of the MIDlet used to be 24 bits of color and now it was 32 bits. Somebody has changed the icon. I knew the Nokia 6131 NFC and 6212 NFC don't support such a high image depth so I rolled back the icon to 24 bits. TADAAA, I was now able to successfully obfuscate and run the application on the NFC phones.

This has been a really annoying and difficult to spot bug.

Interesting facts:

More...

About Adrian Vintu

Adrian Vintu I am a computer software professional lately designing and programming .NET and Android applications.
Send mail

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008 - 2010

Sign in