[Miscellaneous Android Development] zeroxia:
Hi,

The device suddenly fails to install APK via "adb install", I have encountered such error on both V1 and V2 ROMS. Initially it was on V2, so I switched back to V1, yesterday this error came out again, here is the description (The `zte' command is a script like:

adb -s "0123456789ABCDEF" "$@"

)

$ zte install PushBullet_11.apk
5869 KB/s (902880 bytes in 0.150s)
pkg: /data/local/tmp/PushBullet_11.apk
Failure [INSTALL_FAILED_INVALID_APK]
zerox@kanna: ~/download
$ zte push PushBullet_11.apk /data/local/
5999 KB/s (902880 bytes in 0.146s)
zerox@kanna: ~/download
$ zte shell
ZTE V987 # cd /data/local/
ZTE V987 # ls
PushBullet_11.apk
tmp
ZTE V987 # ls -l
-rw------- root root 902880 2013-08-22 09:43 PushBullet_11.apk
drwxrwx--x shell shell 2013-08-22 09:52 tmp
ZTE V987 # pm install PushBullet_11.apk
pkg: PushBullet_11.apk
Failure [INSTALL_FAILED_INVALID_APK]
ZTE V987 # chmod 0644 PushBullet_11.apk
ZTE V987 # ls -l
-rw-r--r-- root root 902880 2013-08-22 09:43 PushBullet_11.apk
drwxrwx--x shell shell 2013-08-22 09:52 tmp
ZTE V987 # pm install PushBullet_11.apk
pkg: PushBullet_11.apk
Success

It seems that the "umask" is not good (077), and by manually "chmod", I can use "pm install APK" in "adb shell", attached is the logcat capture for reference.

I try to create /data/local/.bashrc to set umask, but without avail.

Then I realize the bash itself might be the cause, I flashed TB_hang-up_fix.zip, still no good.

And I reflashed V1 ROM, "adb install" still can't work:

$ zte install download/PushBullet_11.apk
3951 KB/s (902880 bytes in 0.223s)
pkg: /data/local/tmp/PushBullet_11.apk
Failure [INSTALL_FAILED_INVALID_APK]

$ zte shell umask
077

zerox@kanna: ~/download
$ zte push PushBullet_11.apk /data/local/tmp/
6407 KB/s (902880 bytes in 0.137s)
zerox@kanna: ~/download
$ zte shell ls -l /data/local/tmp
-rw------- root root 902880 2013-08-22 09:43 PushBullet_11.apk

As can been seen here, "adb push FILE" created the file in the /data partition with permissions "400", and this seems to be problematic for the package manager to install it.

I will try the V3...

UPDATE:

Some searches lead me to: http://cleanimport.xda/index.php?threads/2154551/

1. I can't find this settings:

Go to Settings > Development > Enable Root for Apps and ADB.

I think this is only available in some AOSP-based ROM like CyanogenMod.

2. Maybe it's SuperSU problem? or the kernel?

UPDATE 2:

I completely wiped the system (data, cache system partitions) in the CWM recovery, one weird thing is that nothing happens when I choose Advanced -> Wipe dalvik cache.

Anyway I installed the V3 ROM, still the same error. Without "adb install" capability it's very inconvenient for development. I have to try to restore to stock ROM. I'm not sure of this, to restore to stock, is there a package flashed by SP flash tool? Or I just download the update package from the following link and apply it in CWM?

http://www.ztedevice.com.cn/support/smart_phone/36845361-4b4c-4f3c-a260-fb61970e9392.html

UPDATE 3:

I restored the my initial CWM backup to get the stock firmware, the commandline "adb install" has no issue.

And then I tried a MIUI ROM (from HERE), and "adb install" is okay too.