Friday, February 3

Solve package installation error on Android

Preface

You might did something strange to your Android if you encounter this problem. It's not normal if you face this:) But probably you know that already and counted the cost:)


Symptoms

When you have a downloaded apk, you are getting this:
Parse error: "There was a problem parsing the package."

Or you might try to install it via pm (android's package manager):
shell@bacon:/sdcard/ $ pm install -r Opera.apk                                                                  pkg: Opera.apk
Failure [INSTALL_FAILED_INVALID_URI]

Solution

adb still works

You can use android's debug bridge to install an apk fine, but that doesn't help if you need to install an apk from your phone.

realpath is the issue

It turns out, that the problem can be resolved by giving the absolute path of the apk to pm.

shell@bacon:/sdcard/ $ pm install -r /sdcard/Opera.apk                                                    pkg: /sdcard/Opera.apk                                        
Success 
Or if you are scripting it for some reason ;)
shell@bacon:/sdcard/ $ pm install -r $(realpath Opera.apk)
                  pkg: /sdcard/Opera.apk                                        
Success 

Have fun:)

No comments:

Post a Comment