Cordova "Hello World" App Won't Display

Cordova hello world app won't display

I finally got it figured.

Problem seemed to be that the apk was not properly installed. The application was in fact able to run when i installed it with the following command (as recommanded by jojo in cordova run android executes fine. But Android 4.1.2 doesn't start the app): adb install <path_to_apk>

So I checked Cordova code to see what happens when apk is installed, and manually launched the command Cordova is using:

adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"

It returns: "Error: unknown option -d"!

If you simply delete the "-d" option, applications run normally with
cordova run android.
On Cordova 5.0.0 you will find this commande 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).

I don't know what this "-d" option is meant too... Is this a Cordova bug?

EDIT

As joris says in comment :

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

Hello World App crashing in Cordova 6.4.0

I changed CPU/ABI from Intel Atom (x86_64) to Google APIs Intel Atom (x86_64). It did work.

Cordova android Hello World app can't find CordovaLib missing

Ok so I hope this can help someone. After playing around with this for like 6 hours today, here is what I have discovered:

As far as selecting your app directory goes, you can get the project to work with either app directory, in my case I could choose LunchBox or the android directory LunchBox/platforms/android. Then select both projects to add to the workspace (you probably don't want to copy the projects into the workspace because then you will have two separate copies of your code and the eclipse versions will be different then the ones you create with cordova CLI).

Once you have both projects in the workspace you can go to the project properties (right click on myApp -> properties) then go to java build path and make sure that the cordova library is included under the libraries tab (this was my problem). You should be able to just hit the add button and select it. (in my picture below I have also included the FacebookLib that I am using, you probably will only have the CordovaLib).

Sample Image

Then you can go into the android tab and make sure the library is referenced there as well. If it's not go ahead and hit add again and select it. Again, I have the facebookLib in there but not everyone will.

Sample Image

Save and then you may want need to clean the project or maybe even restart eclipse (eclipse can be funny sometimes). I also had to go back in again into settings and add the library again because it didn't get synced up the first time. So if it still isn't working, double check all that stuff again.

Hello world Phonegap Android App not loading

Actually you need to create libs folder instead of lib folder, as the latest android SDK is been updated from r17. So just create a libs folder and place the jar file in it. Then automatically it will be added to build path and you will not get this error....

Cordova keeps replacing my code with default Hello World app

You should only modify the html in .\www - this gets copied to platforms\android\src\app\main\assets\www as part of the build process

Error when creating project cordova-lib cordova-app-hello-world missing

The cordova-lib node_modules repository is empty !

Run command

npm install

to the repository

C:\Program Files\nodejs\node_modules\cordova\node_modules\cordova-lib\

Cordova/Phonegap not launches the application in the emulator

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

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 ' + resolvedTarget.target + ' 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.



Related Topics



Leave a reply



Submit