Unable to use the service with Cordova / Phonegap helloworld

I installed the Android SDK + Ant + cordova (3.4.1) + set the PATH variables ( android , ant , cordova ).

At the end of the CLI cordova, this is a usage example:

 Example usage $ cordova create Baz $ cd Baz $ cordova platform add android $ cordova build $ cordova serve android 

-----------------------------------

So, I tried exactly this:

 sebastien@sebastien-xps:Desktop$ cordova create Baz Creating a new cordova project with name "HelloCordova" and id "io.cordova.hellocordova" at location "/home/sebastien/Desktop/Baz" 



 sebastien@sebastien-xps:Desktop$ cd Baz 



 sebastien@sebastien-xps:Baz$ cordova platform add android Creating android project... Creating Cordova project for the Android platform: Path: platforms/android Package: io.cordova.hellocordova Name: HelloCordova Android target: android-19 Copying template files... Running: android update project --subprojects --path "platforms/android" --target android-19 --library "CordovaLib" Resolved location of library project to: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib Updated and renamed default.properties to project.properties Updated local.properties No project name specified, using Activity name 'HelloCordova'. If you wish to change it, edit the first line of build.xml. Added file platforms/android/build.xml Added file platforms/android/proguard-project.txt Updated project.properties Updated local.properties No project name specified, using project folder name 'CordovaLib'. If you wish to change it, edit the first line of build.xml. Added file platforms/android/CordovaLib/build.xml Added file platforms/android/CordovaLib/proguard-project.txt Project successfully created. 



 sebastien@sebastien-xps:Baz$ cordova build Running command: /home/sebastien/Desktop/Baz/platforms/android/cordova/build Buildfile: /home/sebastien/Desktop/Baz/platforms/android/build.xml -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 22.6.2 [checkenv] Installed at /home/sebastien/Desktop/devhome/install/adt-bundle-linux-x86_64-20140321/sdk -setup: [echo] Project Name: HelloCordova [gettype] Project Type: Application -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] Using latest Build Tools: 19.0.3 [echo] Resolving Build Target for HelloCordova... [gettarget] Project Target: Android 4.4.2 [gettarget] API level: 19 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build/res [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build/rsObj [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build/rsLibs [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-gen [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build/classes [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build/dexedLibs [echo] ---------- [echo] Resolving Dependencies for HelloCordova... [dependency] Library dependencies: [dependency] [dependency] ------------------ [dependency] Ordered libraries: [dependency] [dependency] ------------------ [echo] ---------- [echo] Building Libraries with 'debug'... nodeps: -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 22.6.2 [checkenv] Installed at /home/sebastien/Desktop/devhome/install/adt-bundle-linux-x86_64-20140321/sdk -setup: [echo] Project Name: CordovaLib [gettype] Project Type: Android Library -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] Using latest Build Tools: 19.0.3 [echo] Resolving Build Target for CordovaLib... [gettarget] Project Target: Android 4.4.2 [gettarget] API level: 19 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/res [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/libs [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/res [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/rsObj [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/rsLibs [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-gen [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/classes [mkdir] Created dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/dexedLibs [echo] ---------- [echo] Resolving Dependencies for CordovaLib... [dependency] Library dependencies: [dependency] No Libraries [dependency] [dependency] ------------------ -code-gen: [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... [aapt] Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class. -pre-compile: -compile: [javac] Compiling 89 source files to /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/classes [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [echo] Creating library output jar file... [jar] Building jar: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/classes.jar -post-compile: -obfuscate: -dex: [echo] Library project: do not convert bytecode... -crunch: [crunch] Crunching PNG Files in source dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/res [crunch] To destination dir: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/res [crunch] Crunched 0 PNG files to update cache -package-resources: [echo] Library project: do not package resources... -package: [echo] Library project: do not package apk... -post-package: -do-debug: [echo] Library project: do not create apk... [propertyfile] Creating new property file: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/build.prop [propertyfile] Updating property file: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/build.prop [propertyfile] Updating property file: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/build.prop [propertyfile] Updating property file: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/build.prop -post-build: debug: -code-gen: [mergemanifest] Merging AndroidManifest files into one. [mergemanifest] Manifest merger disabled. Using project manifest only. [echo] Handling aidl files... [aidl] No AIDL files to compile. [echo] ---------- [echo] Handling RenderScript files... [echo] ---------- [echo] Handling Resources... [aapt] Generating resource IDs... [echo] ---------- [echo] Handling BuildConfig class... [buildconfig] Generating BuildConfig class. -pre-compile: [echo] Set jars path to: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/classes.jar -compile: [javac] Compiling 3 source files to /home/sebastien/Desktop/Baz/platforms/android/ant-build/classes -post-compile: -obfuscate: -dex: [dex] input: /home/sebastien/Desktop/Baz/platforms/android/ant-build/classes [dex] input: /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/classes.jar [dex] Pre-Dexing /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build/classes.jar -> classes-f44eaf7d8904b207eb36100ec05db9be.jar [dex] Converting compiled files and external libraries into /home/sebastien/Desktop/Baz/platforms/android/ant-build/classes.dex... [dx] Merged dex A (7 defs/2.2KiB) with dex B (205 defs/312.8KiB). Result is 212 defs/383.8KiB. Took 0.3s -crunch: [crunch] Crunching PNG Files in source dir: /home/sebastien/Desktop/Baz/platforms/android/res [crunch] To destination dir: /home/sebastien/Desktop/Baz/platforms/android/ant-build/res [crunch] Processing image to cache: /home/sebastien/Desktop/Baz/platforms/android/res/drawable-hdpi/icon.png => /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-hdpi/icon.png [crunch] (processed image to cache entry /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-hdpi/icon.png: 67% size of source) [crunch] Processing image to cache: /home/sebastien/Desktop/Baz/platforms/android/res/drawable-ldpi/icon.png => /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-ldpi/icon.png [crunch] (processed image to cache entry /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-ldpi/icon.png: 0% size of source) [crunch] Processing image to cache: /home/sebastien/Desktop/Baz/platforms/android/res/drawable-mdpi/icon.png => /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-mdpi/icon.png [crunch] (processed image to cache entry /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-mdpi/icon.png: 0% size of source) [crunch] Processing image to cache: /home/sebastien/Desktop/Baz/platforms/android/res/drawable-xhdpi/icon.png => /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-xhdpi/icon.png [crunch] (processed image to cache entry /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable-xhdpi/icon.png: 53% size of source) [crunch] Processing image to cache: /home/sebastien/Desktop/Baz/platforms/android/res/drawable/icon.png => /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable/icon.png [crunch] (processed image to cache entry /home/sebastien/Desktop/Baz/platforms/android/ant-build/res/drawable/icon.png: 53% size of source) [crunch] Crunched 5 PNG files to update cache -package-resources: [aapt] Creating full resource package... -package: [apkbuilder] Current build type is different than previous build: forced apkbuilder run. [apkbuilder] Creating HelloCordova-debug-unaligned.apk and signing it with a debug key... -post-package: -do-debug: [zipalign] Running zip align on final apk... [echo] Debug Package: /home/sebastien/Desktop/Baz/platforms/android/ant-build/HelloCordova-debug.apk [propertyfile] Creating new property file: /home/sebastien/Desktop/Baz/platforms/android/ant-build/build.prop [propertyfile] Updating property file: /home/sebastien/Desktop/Baz/platforms/android/ant-build/build.prop [propertyfile] Updating property file: /home/sebastien/Desktop/Baz/platforms/android/ant-build/build.prop [propertyfile] Updating property file: /home/sebastien/Desktop/Baz/platforms/android/ant-build/build.prop -post-build: [move] Moving 1 file to /home/sebastien/Desktop/Baz/platforms/android/ant-build [move] Moving 1 file to /home/sebastien/Desktop/Baz/platforms/android/CordovaLib/ant-build debug: BUILD SUCCESSFUL Total time: 18 seconds 



 sebastien@sebastien-xps:Baz$ cordova serve android Static file server running on port 8000 (ie http://localhost:8000) CTRL + C to shut down 302 /android/ 200 /android/www/ 200 /android/www/css/index.css 200 /android/www/cordova.js 200 /android/www/js/index.js 200 /android/www/img/logo.png 



At first glance, this seems to work fine. I can open http://localhost:8000 and it displays something:

 Package Metadata name HelloCordova packageName io.cordova.hellocordova version 0.0.1 Platforms ios android ubuntu amazon-fireos wp7 wp8 blackberry10 www firefoxos windows8 Plugins 

I can click on the Android link, the problem is that when I do this, a strange dialog box appears with the question = [] , asking me to confirm or cancel the following text, pre-filled with text:

 gap:["PluginManager","startup","PluginManager1413322690"] 

After adoption, I see the background of Cordova, connecting to device , but nothing happens, except that it looks like an infinite loop that I see on the console:

 The key "target-densitydpi" is not supported. localhost/:25 Falling back on PROMPT mode since _cordovaNative is missing. Expected for Android 3.2 and lower only. cordova.js:966 698173 processMessage failed: invalid message: 

The number 698173 growing

Can someone tell me what this strange behavior is?

+8
android cordova
May 13 '14 at 13:41
source share
3 answers

After discussing the IRC with the Cordova developer, the serve team was not documented in any way, and it’s mostly useful to serve the content . Phonegap Application Developer is a mobile application that was recently released, and as I understand it now, it intends to serve the application for a regular desktop browser.

For testing desktop browsers, I have so far been successful with the Ripple emulator (and not with the Chrome plugin, which seems to be unknown, but the NPM package).

For example, you can test in browser browser applications:

 npm install -g ripple-emulator ripple emulate 

This may help you: https://github.com/stample/gulp-browserify-react-phonegap-starter

+3
Jul 03 '14 at 23:14
source share

I know this is an old thread, but today I had the same problem and I really don't want to install the emulator

you need to add a browser platform to your application

 cordova platform add browser 

and tell the browser http://localhost:8000/browser/www/

+14
May 08 '15 at 20:31
source share

When you initially request javascript dialogs (for example, gap: ["PluginManager", ...]), you can click Cancel to have the application load correctly.

+5
Jun 04 '14 at 16:49
source share



All Articles