Android: manifest targetSdkVersion change resulted in: icon not visible, widget no longer works, and cannot access data
I recently upgraded my Android app to support multiple resolutions. Previously, my Android.manifest file had a line:
To support multiple density and resolution devices, I changed this to:
<supports-screens
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
I then added a couple of new directories, like drawable-hdpi-v4 and drawable-long-hdpi-v4 that includes the high-res versions of the graphics. That's about it.
Ever since releasing this update, there have been a decent number of users complaining about various problems:
- the app icon doesn't appear (I did not create a high res version of the icon)
the home screen widget no longer works, even if they delete and re-add it (this code did not change with the update). I've had a user send me their error log, which shows:
03-19 20:59:41.617 W/ActivityManager( 1854): Unable to launch app com.alt12.babybump/10078 for broadcast Intent { action=android.appwidget.action.APPWIDGET_UPDATE flags=0x4 comp={com.alt12.babybump/com.alt12.babybump.WidgetGirl} (has extras开发者_运维技巧) }: process is bad
There is one questionable section in my existing widget code that may be relevant:
@Override
public void onReceive(Context context, Intent intent) {
// v1.5 fix that doesn't call onDelete Action
final String action = intent.getAction();
if (AppWidgetManager.ACTION_APPWIDGET_DELETED.equals(action)) {
final int appWidgetId = intent.getExtras().getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
this.onDeleted(context, new int[] { appWidgetId });
}
} else {
super.onReceive(context, intent);
}
}
And perhaps most troublesome: the sqlite database is no longer accessible/writeable for some users so their data is no longer available
. I did add the WRITE_EXTERNAL_STORAGE
permission to the manifest. This is only happening to certain users and it tends to be HTC Eris users. In that error log I see things such as:
03-19 16:00:56.173 E/FlurryAgent( 4791): java.io.FileNotFoundException: /data/data/com.alt12.babybump/files/.flurryagent.-2333f5cb
03-19 16:00:56.173 E/FlurryAgent( 4791): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:231)
03-19 16:01:09.393 E/Database( 4791): sqlite3_open_v2("/data/data/com.alt12.babybump/databases/uitematmamad.db", &handle, 6, NULL) failed
03-19 16:01:09.393 W/System.err( 4791): android.database.sqlite.SQLiteException: unable to open database file
It's as if the update has caused a new process and it can't access the old process's data, or something.
Any help appreciated!
this combination goofed it up:
I then added a couple of new directories, like drawable-hdpi-v4 and drawable-long-hdpi-v4 that includes the high-res versions of the graphics.
remove the drawable--v4 directories and put graphics in the drawable- folders..that will fix your graphics
On the other errors..have you checked the Motorola android devloper forums yet?
精彩评论