Search code examples
androidcordovacordova-cli

cordova run android not deploying any-more with cordova 5/cordova android 4.0.0


I've just updated from cordova 3.6 to cordova 5 + cordova android 4.0.0 on a Windows computer.

Before the update, everything was working perfectly, but now if I run cordova run android, the app is not deployed to the device. (I get a success message from the CLI but nothing on the device)

I tried specifying or not the target device on the command line, it makes no change.

The device is seen from adb and adb commands work. I can deploy the app using android studio.

Here is what I get if I try to create and run a new project :

cordova create toto&&cd toto&&cordova platform add android&&cordova run android
Creating a new cordova project.
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.cordova.hellocordova
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-22
Copying template files...
Android project created with [email protected]
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-whitelist
npm http 304 https://registry.npmjs.org/cordova-plugin-whitelist
Installing "cordova-plugin-whitelist" for android
Running command: C:\temp\toto\platforms\android\cordova\run.bat
ANDROID_HOME=C:\Programmes\adt-bundle\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0
WARNING : No target specified, deploying to device '13352521650443'.
Running: C:\temp\toto\platforms\android\gradlew cdvBuildDebug -b C:\temp\toto\platforms\android\build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true
...
...
BUILD SUCCESSFUL

Total time: 38.159 secs
Built the following apk(s):
    C:\temp\toto\platforms\android\build\outputs\apk\android-debug.apk
Using apk: C:\temp\toto\platforms\android\build\outputs\apk\android-debug.apk
Installing app on device...
Launching application...
LAUNCH SUCCESS

LAUNCH SUCCESS but still nothing on the device.


Solution

  • Ok, this other SO question and this one also have explanation for this issue. There is a bug open at Cordova : https://issues.apache.org/jira/browse/CB-8912

    The issue is caused by the usage of -d option when launching adb install command. This option seems to be not supported by devices running android versions before kitkat (at least does not work in 4.0.4 and 4.1.2).