#Androiddev fiddling – package deploy error and using preferences

Hit an error this morning when deploying an Android project:

WARN/ResourceType(586): Bad XML block: header size 28024 or total size 1702240364 is larger than data size 776
WARN/PackageParser(586): Unable to read AndroidManifest.xml of /data/app/vmdl39451.tmp
WARN/PackageParser(586): java.io.FileNotFoundException: Corrupt XML binary file
WARN/PackageParser(586):     at android.content.res.AssetManager.openXmlAssetNative(Native Method)

ERROR/PackageManager(586): Couldn’t find a package name in : /data/app/vmdl39451.tmp

Eclipse had also given me some kind of error about being unable to parse the output of aapk and to check console output. I’ve deleted console output so I don’t remember what was there, but I’m not sure it was illuminating. This was pretty confusing. I played around with cleaning the project in Eclipse; I tried creating the apk myself to see if I got any interesting errors:

[luke@7of9 Listviews]$ apkbuilder bin/Listviews.apk -rf .
Using keystore: /home/luke/.android/debug.keystore
[luke@7of9 Listviews]$ ls -l bin
total 40
-rw-rw-r–. 1 luke luke  5060 Sep  5 07:54 classes.dex
-rw-rw-r–. 1 luke luke 18925 Sep  5 08:49 Listviews.apk
drwxrwxr-x. 3 luke luke  4096 Sep  5 07:52 net
-rw-rw-r–. 1 luke luke  6995 Sep  5 07:54 resources.ap_
[luke@7of9 Listviews]$ adb install -r bin/Listviews.apk
250 KB/s (18925 bytes in 0.073s)
Can’t dispatch DDM chunk 46454154: no handler defined
Can’t dispatch DDM chunk 4d505251: no handler defined
pkg: /data/local/tmp/Listviews.apk

Alas; not very helpful. But somewhere along the way, I did get something useful:

Parser exception for /Listviews/AndroidManifest.xml: The element type “activity” must be terminated by the matching end-tag “</activity>”.
org.xml.sax.SAXParseException: The element type “activity” must be terminated by the matching end-tag “</activity>”.

Ah – now that I can understand and do something about. Not sure why Eclipse didn’t give me a heads up on that. Adding that extra slash fixed everything :-)


For some reason there’s virtually no documentation I can find in the developers guide about the handy Preferences activity and resource type. What I know I get from Ed Burnette’s book Hello, Android; and frankly that’s not too detailed about what’s going on.(OK; I found some very general stuff here and more specifics about using the activity and resource in the PreferenceActivity reference docs.)

This was a problem when I tried to set up my Preferences activity and got a runtime exception after choosing a setting from a list.

ERROR/AndroidRuntime(931): java.lang.NullPointerException
ERROR/AndroidRuntime(931):     at android.preference.ListPreference.onDialogClosed(ListPreference.java:218)
ERROR/AndroidRuntime(931):     at android.preference.DialogPreference.onDismiss(DialogPreference.java:359)
ERROR/AndroidRuntime(931):     at android.app.Dialog$DismissCancelHandler.handleMessage(Dialog.java:946)


Those are all Android classes – none of mine are in the mix. The pref I tried to change comes from this specification:

android:summary=”Which layout do you want?”

Nothing obviously wrong. It occurred to me, though, that the values array there is an integer array, while the entries are, naturally, strings (for the user to see).  I tried changing the values to strings (and then parsing the prefs into integers when they come out) and this seemed to work fine. So evidently you can’t use integer arrays directly as entryValues on a ListPreference.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: