gerumato gerumato - 1 year ago 151
Android Question

cordova run android executes fine. But Android 4.1.2 doesn't start the app

I'm starting to develop and android app using Cordova 5.0.0 (cordova -v prints 5.0.0), and testing it on a Moto Razr D1 with Android 4.1.2.
Under Windows 7, btw.

cordova build

and manually copying the platforms/android/build/output/apk/android-degug.apk to the SD and installing works fine.

cordova emulate android

runs fine on emulator with android version >4.1.2

cordova run android

builds successfully, says using apk platforms/android/build/output/apk/android-debugger.apk, which seems ok,
installing app, launching and LAUNCH SUCCESS. however as you can see in this screenshot

Razr Screenshot

This "WALLPAPER/MANAGE/SETTINGS" thing happens, and that's it.

If I execute:

cordova emulate android

On an emulator with Android 4.1.2 Jelly, an equal output


Total time: 6.352 secs
Built the following apk(s):
Installing app on emulator...
Using apk: C:\android\Some\platforms\android\build\outputs\apk\android-debug.apk
Launching application...

same "WALLPAPAER/MANAGE/SETTINGS", here's another screenshot Emulator Screenshot

Any ideas how to solve this issue? Thanks in advance...

PS: If I've installed the apk previously, the Razr will startup the old version, instead of the WALLPAPER/MANAGE/SETTINGS thing. So I have to uninstall it before trying to run the cordova run commands.

Answer Source

I met the same problem (Cordova "hello world" app won't display) and found a way to pass through it (but I don't really understand the underlying causes).

Problem seemed to occur when installing the apk. On Cordova 5.0.0, adb commands to install the apk can be found at line 101 of file platforms\android\cordova\lib\device.js (and at line 311 of platforms\android\cordova\lib\emulator.js for cordova emulate android):

adb -s ' + + ' install -r -d "' + apk_path + '"

Current command returns to me: "Error: unknown option -d"!

If you simply delete the "-d" option, applications run normally with cordova run android.


The -d is supposed to come directly after adb (as in --device) instead of after install. So you can just move it there instead of removing it.

Plus, here is the opened issue on apache cordova issue tracker

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download