openFrameworks 0.9.0-RC2 in Android Studio on OSX 10.11.1: INSTALL_FAILED_CONTAINER_ERROR

Hey folks,

when starting an emulator with API 22 I get the following error:

Application Installation Failed

Installation failed with message
INSTALL_FAILED_CONTAINER_ERROR.
It is possible that this issue is resolved by
uninstalling an existing version of the apk if it is
present, and then re-installing it.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

… though, the emulator is running.

I tried cancelling it, I tried clicking OK, which results in:

Session ‘androidEmptyExample’: error

The androidEmptyExample console log looks like this:

Device connected: emulator-5554
Device Nexus_5_API_22_x86 [emulator-5554] is online, waiting for processes to start up…
Device is ready: Nexus_5_API_22_x86 [emulator-5554]
Target device: Nexus_5_API_22_x86 [emulator-5554]
Uploading file
local path: /Users/$USER/Documents/openFrameworks/openFrameworks_Android_v0.9.0-RC2/examples/android/androidEmptyExample/build/outputs/apk/androidEmptyExample-debug.apk
remote path: /data/local/tmp/cc.openframeworks.androidEmptyExample
Installing cc.openframeworks.androidEmptyExample
DEVICE SHELL COMMAND: pm install -r “/data/local/tmp/cc.openframeworks.androidEmptyExample”
pkg: /data/local/tmp/cc.openframeworks.androidEmptyExample
Failure [INSTALL_FAILED_CONTAINER_ERROR]

DEVICE SHELL COMMAND: pm uninstall cc.openframeworks.androidEmptyExample
DELETE_FAILED_INTERNAL_ERROR

Any ideas on what could be the problem?

Thank you very much!

that means that the application is already installed in the device (in the emulator in this case) but it’s not compatible with the one you are going to install so it needs to uninstall it first. the android emulator is kind of buggy and we don’t support it officially the easiest is to test applications in a real device but it might be that if the application is really installed you can probably uninstall it manually and try to run the application again from android studio

Unfortunately, I’m also experiencing the exact same behavior on my Android device …

Target device: lge-nexus_5-052a4255f0bb2c9e
Uploading file
	local path: /Users/$USER/Documents/openFrameworks/openFrameworks_Android_v0.9.0-RC2/apps/myGmcApps/androidPolygonExample/build/outputs/apk/androidPolygonExample-debug.apk
	remote path: /data/local/tmp/cc.openframeworks.androidPolygonExample
Installing cc.openframeworks.androidPolygonExample
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/cc.openframeworks.androidPolygonExample"
	pkg: /data/local/tmp/cc.openframeworks.androidPolygonExample
Failure [INSTALL_FAILED_CONTAINER_ERROR]


DEVICE SHELL COMMAND: pm uninstall cc.openframeworks.androidPolygonExample
DELETE_FAILED_INTERNAL_ERROR

do you have the application installed already soehow?

this usually happens if for example you have an application installed through google play or signed with a relase signature and you try to install a debug one. it can also happen if you installed it a while ago with a debug signature but then installed a different IDE version which might come with a different debug signature.

if that’s the case try uninstalling the applicaiton first manually from the phone.

I tried to install the emptyExample and the PolygonExample …

I tried to remove the apps from /data/local/tmp/ via adb (root) shell …

The error message always keeps popping up.

root@hammerhead:/data/local/tmp # ls
cc.openframeworks.androidPolygonExample
glsl_shader_log.txt
init.rc

root@hammerhead:/data/local/tmp # pm install -r cc.openframeworks.androidPolygonExample
        pkg: cc.openframeworks.androidPolygonExample
Failure [INSTALL_FAILED_INVALID_URI]

root@hammerhead:/data/local/tmp # pm install -r cc.openframeworks.androidPolygonExample
        pkg: cc.openframeworks.androidPolygonExample
Failure [INSTALL_FAILED_INVALID_URI]

PS: I’m using CyanogenMod 12.1 … so Android 5.1(.1) …

In 0.9.0, this is still happening … any ideas?

Please note that, the failure type is changed from INSTALL_FAILED_CONTAINER_ERROR to INSTALL_FAILED_INVALID_URI

Is this a rooted device?

I just checked my developer options: apps and ADB have root access.

Rancs: No, the failure type is not changed in Android Studio:

Uploading file
	local path: /Users/$USER/Developer/openFrameworks/openFrameworks_v0.9.0_Android/apps/gmcApps/emptyExample_android/build/outputs/apk/emptyExample_android-debug.apk
	remote path: /data/local/tmp/cc.openframeworks.androidEmptyExample
Installing cc.openframeworks.androidEmptyExample
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/cc.openframeworks.androidEmptyExample"
	pkg: /data/local/tmp/cc.openframeworks.androidEmptyExample
Failure [INSTALL_FAILED_CONTAINER_ERROR]


DEVICE SHELL COMMAND: pm uninstall cc.openframeworks.androidEmptyExample
DELETE_FAILED_INTERNAL_ERROR

The failure type is different, when manually trying to execute pm -r install cc.openframeworks.androidEmptyExample in adb shell (so directly on the device) …

~ >> adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
cd dataroot@hammerhead:/ # cd data/local/tmp
root@hammerhead:/data/local/tmp # ls
cc.openframeworks.androidEmptyExample
glsl_shader_log.txt
init.rc
root@hammerhead:/data/local/tmp # pm install -r cc.openframeworks.androidEmptyExample
        pkg: cc.openframeworks.androidEmptyExample
Failure [INSTALL_FAILED_INVALID_URI]

First of all, for the emulator issue:
Check your emulator settings on AVD. Does it have an external storage? If no, create an emulator with 256MB sdcard (or try 512MB if it is 256MB)

If it already has a sdcard and more MBs do not solve the issue, then you may try changing installLocation in the manifest to “auto”

android:installLocation="auto"

or even try installLocation=“internalOnly”

(But these are not suitable for device. When you test the app on the device, you should revert to “preferExternal”)

The emulator has the default of 200 MB, though I also tried it with 256/512/1024 MB.

… after changing the installLocation to 'auto' the emulator starts the emptyExample.


The Nexus 5 does not have an external SD card, so maybe that’s the problem, too?

… after changing the installLocation to 'auto' the Nexus device starts the emptyExample.


Why should this setting not be used for my device? Thanks very much that far!

Oh good to hear that the emulator works finally :smile:

openFrameworks installs himself automatically to sdcard. That’s why you should use “preferExternal” on the real devices. The emulator can work with “auto” because it is configured like that by its own implementation. But your Nexus5 without a sdcard can not run your app. Plug a sdcard then try it again.

So at least everything is clear now, isn’t it?

… but one cannot plug a SD-card into a Nexus device, or am I wrong?

The emptyExample is installed and started on my Nexus device with setting installLocation to 'auto'

Oh sorry I didn’t read the Nexus has started the emptyExample part on your previous post :smile: Ok that’s good.

I think the Nexus devices have an emulated sdcard, which is just a symlink so apps and such know where ti be installed.

Strange that preferExternal does not work, I would interpret it as if there is an sdcard, install there, else internal.

So maybe it’s really a problem of the sdcard path or something?

Glad it works now, though it seems like a workaround and not a solution.

Maybe arturo knows anything about that?

the preferExternal location was somthing i set cause on old phones (android 2.3) it was really easy to fill the internal storage with OF applications since most applications in android back then were about 2-3Mb while OF ones where about 20Mb minimum.

i don’t think it’ll be a problem to set it to auto now and if it fixes this problem i think we should just default to that

btw, this setting only means that the binary itself will be installed in the external or internal storage, once it’s installed no matter where, the application will uncompress the assets in the external storage always

Ok, great. Seems we have fixed this. : )

Thanks for your help!