Compiled cordova android app is built succesfully but doesn't start in android < 4.2

This problem is very annoying and happens only with some users, not all the cordova developer seems to present this error.

You'll only receive this "magic" information :


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

That can make you crazy ! Fortunately the solution is really simple.

We will edit 2 javascript files, the emulator and device files which are the cause of the problem. If you are testing on emulator, you can edit only the emulator file and if you are using a device then edit only the device file, but if you want , you can edit both of them for future ocations.

Locate :

// edit this if you test your app with a device

// Edit this if you test your app with emulator

Then search this line : 

(on device.js is near at the line 102 and on emulator.js is near at the line 313)

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

And replace with :

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

You only need to remove the "-d" option, then the app will run normally with cordova run android.

This could interest you

Become a more social person