jenkins can't archive the debug apk - android

I'm trying to set up jenkins for building android apps and archiving builds.
However, it seems that I can't archive the debug apk.
Ant is run with "clean debug" and "archive artifacts" is selected. I tried with */.apk and with bin/test-debug.apk, which is the file I want(and is visible through the jenkins workspace browser.
console log:
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/test-project/workspace
Checkout:workspace / /var/lib/jenkins/jobs/test-project/workspace - hudson.remoting.LocalChannel#eb3f66
Using strategy: Default
Last Built Revision: Revision bae064038961f07de92252f6f65d222e90d2d871 (origin/HEAD, origin/master)
Checkout:workspace / /var/lib/jenkins/jobs/test-project/workspace - hudson.remoting.LocalChannel#eb3f66
Fetching changes from 1 remote Git repository
Fetching upstream changes from /home/andraz/test/.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision bae064038961f07de92252f6f65d222e90d2d871 (origin/HEAD, origin/master)
Checking out Revision bae064038961f07de92252f6f65d222e90d2d871 (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
[workspace] $ ant -Dsdk.dir=/home/andraz/android-sdk-linux clean debug
Buildfile: /var/lib/jenkins/jobs/test-project/workspace/build.xml
-pre-clean:
clean:
[delete] Deleting directory /var/lib/jenkins/jobs/test-project/workspace/bin
[delete] Deleting directory /var/lib/jenkins/jobs/test-project/workspace/gen
-set-mode-check:
-set-debug-files:
-set-debug-mode:
-debug-obfuscation-check:
-setup:
[echo] Creating output directories if needed...
[mkdir] Created dir: /var/lib/jenkins/jobs/test-project/workspace/bin
[mkdir] Created dir: /var/lib/jenkins/jobs/test-project/workspace/bin/res
[echo] Gathering info for test...
[setup] Android SDK Tools Revision 17
[setup] Project Target: Android 2.2
[setup] API level: 8
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] No library dependencies.
[setup]
[setup] ------------------
[setup] API<=15: Adding annotations.jar to the classpath.
[setup]
[setup] ------------------
[setup] WARNING: No minSdkVersion value set. Application will install on all Android versions.
-build-setup:
[mkdir] Created dir: /var/lib/jenkins/jobs/test-project/workspace/gen
[mkdir] Created dir: /var/lib/jenkins/jobs/test-project/workspace/bin/classes
-pre-build:
-code-gen:
[echo] ----------
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 4 source files to /var/lib/jenkins/jobs/test-project/workspace/bin/classes
-post-compile:
-obfuscate:
-dex:
[dex] Converting compiled files and external libraries into /var/lib/jenkins/jobs/test-project/workspace/bin/classes.dex...
-crunch:
[crunch] Crunching PNG Files in source dir: /var/lib/jenkins/jobs/test-project/workspace/res
[crunch] To destination dir: /var/lib/jenkins/jobs/test-project/workspace/bin/res
[crunch] Crunched 0 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 test-debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
[zipalign] Running zip align on final apk...
[echo] Debug Package: /var/lib/jenkins/jobs/test-project/workspace/bin/test-debug.apk
[propertyfile] Creating new property file: /var/lib/jenkins/jobs/test-project/workspace/bin/build.prop
[propertyfile] Updating property file: /var/lib/jenkins/jobs/test-project/workspace/bin/build.prop
[propertyfile] Updating property file: /var/lib/jenkins/jobs/test-project/workspace/bin/build.prop
[propertyfile] Updating property file: /var/lib/jenkins/jobs/test-project/workspace/bin/build.prop
-post-build:
debug:
BUILD SUCCESSFUL
Total time: 4 seconds
Archiving artifacts
ERROR: No artifacts found that match the file pattern "**/*.apk". Configuration error?
Build step 'Archive the artifacts' changed build result to FAILURE
Finished: FAILURE
it seems to me that file is generated but somehow not found.
also if I chose to archive bin/test* it stores test-debug-unaligned.apk.d, test.apk_, test.apk.d but no apks
any insights?

It seems that the file is simply not there when archiving happens. As a last build step run shell script that executes ls -l bin and see if the file is indeed there by examining the console output.

Related

codenameone server build error

I am designing an android application using codenameone. after running the application on the codenameone simulator I decided to build, the build server is giving me the following error log :
Executing: /home/ec2-user/android-sdk/tools/android create project --target android-21 --name Application --path /tmp/build2045678520977010415xxx/Application --activity ApplicationStub --package com.microserve.mssn Created directory /tmp/build2045678520977010415xxx/Application/src/com/microserve/mssn
Added file /tmp/build2045678520977010415xxx/Application/src/com/microserve/mssn/ApplicationStub.java
Created directory /tmp/build2045678520977010415xxx/Application/res
Created directory /tmp/build2045678520977010415xxx/Application/bin
Created directory /tmp/build2045678520977010415xxx/Application/libs
Created directory /tmp/build2045678520977010415xxx/Application/res/values
Added file /tmp/build2045678520977010415xxx/Application/res/values/strings.xml
Created directory /tmp/build2045678520977010415xxx/Application/res/layout
Added file /tmp/build2045678520977010415xxx/Application/res/layout/main.xml
Created directory /tmp/build2045678520977010415xxx/Application/res/drawable-xhdpi
Created directory /tmp/build2045678520977010415xxx/Application/res/drawable-hdpi
Created directory /tmp/build2045678520977010415xxx/Application/res/drawable-mdpi
Created directory /tmp/build2045678520977010415xxx/Application/res/drawable-ldpi
Added file /tmp/build2045678520977010415xxx/Application/AndroidManifest.xml
Added file /tmp/build2045678520977010415xxx/Application/build.xml
Added file /tmp/build2045678520977010415xxx/Application/proguard-project.txt
Executing: /home/ec2-user/android/ant/bin/ant release Buildfile: /tmp/build2045678520977010415xxx/Application/build.xml
-set-mode-check:
-set-release-mode:
-release-obfuscation-check:
[echo] proguard.config is proguard.cfg
[echo] Proguard.config is enabled
-pre-build:
-check-env:
[checkenv] Android SDK Tools Revision 23.0.5
[checkenv] Installed at /home/ec2-user/android-sdk
-setup:
[echo] Project Name: Application
[gettype] Project Type: Application
-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
[echo] Resolving Build Target for Application...
[gettarget] Project Target: Android 5.0
[gettarget] API level: 21
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /tmp/build2045678520977010415xxx/Application/bin/res
[mkdir] Created dir: /tmp/build2045678520977010415xxx/Application/bin/rsObj
[mkdir] Created dir: /tmp/build2045678520977010415xxx/Application/bin/rsLibs
[mkdir] Created dir: /tmp/build2045678520977010415xxx/Application/gen
[mkdir] Created dir: /tmp/build2045678520977010415xxx/Application/bin/classes
[mkdir] Created dir: /tmp/build2045678520977010415xxx/Application/bin/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for Application...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'release'...
[subant] No sub-builds to iterate on
-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...
[aapt] /tmp/build2045678520977010415xxx/Application/res/values/strings.xml:3: error: Apostrophe not preceded by \ (in Da'awah Week)
BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/home/ec2-user/android-sdk/tools/ant/build.xml:698: null returned: 1
Total time: 1 second
The inclusion of the ' character in the app title seems to be the source of the problem. Its something that we can probably fix in the build server but you might have issues with it in other platforms too.

Phonegap run android gives error

I am trying to run the basic hello-world app. I am totally frustrated can't find solution to this. What is wrong? I have tried these solutions but still no luck. Please help me :'(
C:\apps>phonegap create app3
[phonegap] create called with the options C:\apps\app3 com.phonegap.helloworld HelloWorld
[phonegap] Customizing default config.xml file
[phonegap] created project at C:\apps\app3
C:\apps>cd app3
C:\apps\app3>phonegap local run android
[phonegap] adding the Android platform...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.phonegap.helloworld
Name: HelloWorld
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: C:\apps\app3\platforms\android\CordovaLib
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'HelloWorld'.
If you wish to change it, edit the first line of build.xml.
Added file C:\apps\app3\platforms\android\build.xml
Added file C:\apps\app3\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 C:\apps\app3\platforms\android\CordovaLib\build.xml
Added file C:\apps\app3\platforms\android\CordovaLib\proguard-project.txt
Project successfully created.
cp: no such file or directory: C:\apps\app3\icon.png
cp: no such file or directory: C:\apps\app3\res\icon\ios\icon-72.png
[phonegap] compiling Android...
cp: no such file or directory: C:\apps\app3\icon.png
cp: no such file or directory: C:\apps\app3\res\icon\ios\icon-72.png
Buildfile: C:\apps\app3\platforms\android\build.xml
[taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 23.0.0
[checkenv] Installed at F:\Android\SDK-for-kepler\sdk
-setup:
[echo] Project Name: HelloWorld
[gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for HelloWorld...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-build
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\res
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\rsObj
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\rsLibs
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-gen
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\classes
[mkdir] Created dir: C:\apps\app3\platforms\android\ant-build\dexedLibs
[echo] ----------
[echo] Resolving Dependencies for HelloWorld...
[dependency] Library dependencies:
[dependency]
[dependency] ------------------
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
[taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.
nodeps:
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 23.0.0
[checkenv] Installed at F:\Android\SDK-for-kepler\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.1.0
[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: C:\apps\app3\platforms\android\CordovaLib\res
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\libs
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\res
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\rsObj
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\rsLibs
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-gen
[mkdir] Created dir: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes
[mkdir] Created dir: C:\apps\app3\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 90 source files to C:\apps\app3\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: C:\apps\app3\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: C:\apps\app3\platforms\android\CordovaLib\res
[crunch] To destination dir: C:\apps\app3\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: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\apps\app3\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\apps\app3\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: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar
-compile:
[javac] Compiling 3 source files to C:\apps\app3\platforms\android\ant-build\classes
-post-compile:
-obfuscate:
-dex:
[dex] input: C:\apps\app3\platforms\android\ant-build\classes
[dex] input: C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar
[dex] Pre-Dexing C:\apps\app3\platforms\android\CordovaLib\ant-build\classes.jar -> classes-b6d5849ba546b3720c0e46effd6702fc.jar
[dx] Error occurred during initialization of VM
[dx] Could not reserve enough space for object heap
[dx] Could not create the Java virtual machine.
BUILD FAILED
F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:892: The following error occurred while executing this line:
F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:894: The following error occurred while executing this line:
F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:906: The following error occurred while executing this line:
F:\Android\SDK-for-kepler\sdk\tools\ant\build.xml:283: null returned: 1
Total time: 4 seconds
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\apps\app3\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
{ [Error: C:\apps\app3\platforms\android\cordova\build.bat: Command failed with exit code 2] code: 2 }
[error] C:\apps\app3\platforms\android\cordova\build.bat: Command failed with exit code 2
this worked for me
Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
taken from this link
After seeing your log it seems to be java heap memory issue..
See this question for more help.. it suggests to use 64-bit JDK.
This link might also help you..
Your logcat output clearly say that application build is failed, beacuse of sdk tools issue. add the path of sdk tools in enviroment variables,like this yourpath\sdk\platform-tools\;'your path'\sdk\tools\.Make sure that path is added in this way go to advancedsystemsettings->Enviromentvariables->systemvariables(not the user variable) select the path system variable and add your path
Here is how to fix it:
Go to Start->Control Panel->System->Advanced(tab)->Environment Variables->System
Variables->New:
Variable name: _JAVA_OPTIONS
Variable value: -Xmx512M
Variable name: Path
Variable value: ;C:\Program Files\Java\jre6\bin;F:\JDK\bin;
Change this to your appropriate path.

building error in pgs4a - Linux

I use Fedora Linux
I installed the pgs4a 0.9.4 and have my sdk updated with the api-8 ok, but when I try to build using "./android.py build /home/armando/projects/games/amh release install > log_building.txt", I get this result from my terminal
./android.py build /home/armando/projects/games/amh release install
Updating build files.
Updated project.properties
Updated local.properties
Added file ./build.xml
Updated file ./proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
Creating assets directory.
Packaging internal data.
Listing private ...
Listing private/lib ...
Listing private/lib/PIL ...
Listing private/lib/android ...
Compiling private/lib/android/__init__.py ...
Compiling private/lib/android/apk.py ...
Compiling private/lib/android/mixer.py ...
Listing private/lib/encodings ...
Listing private/lib/json ...
Listing private/lib/pygame ...
Listing private/lib/pygame/threads ...
Listing private/lib/sqlite3 ...
Listing /home/armando/projects/games/amh ...
Compiling /home/armando/projects/games/amh/editor.py ...
Compiling /home/armando/projects/games/amh/game.py ...
Listing /home/armando/projects/games/amh/levels ...
Listing /home/armando/projects/games/amh/levels/scores ...
Listing /home/armando/projects/games/amh/res ...
Listing /home/armando/projects/games/amh/res/icons ...
Listing /home/armando/projects/games/amh/res/sfx ...
Listing /home/armando/projects/games/amh/res/tiles ...
Compiling /home/armando/projects/games/amh/run_game.py ...
Compiling /home/armando/projects/games/amh/tile.py ...
Listing engine-private ...
I'm using Ant to build the package.
Buildfile: /home/armando/projects/pgs4a/build.xml
-check-env:
[checkenv] Android SDK Tools Revision 22.6.3
[checkenv] Installed at /home/armando/projects/pgs4a/android-sdk
-setup:
[echo] Project Name: madals_amh
[gettype] Project Type: Application
-pre-clean:
clean:
[delete] Deleting directory /home/armando/projects/pgs4a/bin
[delete] Deleting directory /home/armando/projects/pgs4a/gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
[subant] No sub-builds to iterate on
-set-mode-check:
-set-release-mode:
-release-obfuscation-check:
[echo] proguard.config is ${proguard.config}
-pre-build:
-check-env:
[checkenv] Android SDK Tools Revision 22.6.3
[checkenv] Installed at /home/armando/projects/pgs4a/android-sdk
-setup:
[echo] Project Name: madalenas_mhajong-madalenas
[gettype] Project Type: Application
-build-setup:
[getbuildtools] Using latest Build Tools: 19.1.0
[echo] Resolving Build Target for madals_amh...
[gettarget] Project Target: Android 4.1.2
[gettarget] API level: 16
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /home/armando/projects/pgs4a/bin
[mkdir] Created dir: /home/armando/projects/pgs4a/bin/res
[mkdir] Created dir: /home/armando/projects/pgs4a/bin/rsObj
[mkdir] Created dir: /home/armando/projects/pgs4a/bin/rsLibs
[mkdir] Created dir: /home/armando/projects/pgs4a/gen
[mkdir] Created dir: /home/armando/projects/pgs4a/bin/classes
[mkdir] Created dir: /home/armando/projects/pgs4a/bin/dexedLibs
[echo] ----------
[echo] Resolving Dependencies for madalenas_mhajong-madalenas...
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'release'...
[subant] No sub-builds to iterate on
-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...
[aapt] /home/armando/projects/pgs4a/bin/AndroidManifest.xml:2: error: Error: Float types not allowed (at 'versionCode' with value '1.0').
BUILD FAILED
/home/armando/projects/pgs4a/android-sdk/tools/ant/build.xml:653: The following error occurred while executing this line:
/home/armando/projects/pgs4a/android-sdk/tools/ant/build.xml:698: null returned: 1
Total time: 6 seconds
The build seems to have failed.
First: if someone here knows how to solve this error, I would greatly appreciate it if you help me
Second: anybody in this forum know how I can use a existing sdk installation in my home dierctory with I use to compile programs using processing and it is wroking fine for me at now, it install my apk in my device without any problem also.
so, wich file I need to change to apoint to the my "~/sdk" directory, instead of pointing to the "pgs4a/android-sdk" directory, when I command "./android.py build ..." in my shell?
peace!
marquessbr
Posts: 1
Joined: Tue May 20, 2014 11:47 am
Top
Try running
./android.py configure directory
again and use a version number that is an integer.
I have a video of the config process for pgs4a 0.9.4 here:
http://www.youtube.com/watch?v=bEc72xutmco&feature=share&list=PLxvyAnoL-vu5sNgzos6_v6nX-j8N4H-Pd&index=6
It is running on Ubuntu. I've installed pgs4a on Linux a number of times and the install and build went smoothly. Feel free to ask me more questions if you're still stuck.
Oh, I also have a FAQ here:
http://discussion.pychildren.org/t/faq-for-python-on-android-development/9
It was originally intended for kids, but adults seem to be using the FAQ more.

Can't use serve with Cordova / Phonegap helloworld

I've installed Android SDK + Ant + cordova (3.4.1) + set PATH variables (android, ant, cordova commands are available)
At the end of the cordova CLI, there's this exemple usage:
Example usage
$ cordova create Baz
$ cd Baz
$ cordova platform add android
$ cordova build
$ cordova serve android
-----------------------------------
So I tried just that exemple:
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 (i.e. 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
This seems to work fine at first glance.
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 when I do so, a strange dialog box appears with question = [], asking me to confirm or cancel the following text prefilled text:
gap:["PluginManager","startup","PluginManager1413322690"]
After accepting, I can see the background Cordova, connecting to device but nothing happens except something that looks like an infinite loop that I can see in 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 is growing
Can someone tell me what is this strange behavior?
I know it is an old thread, but I had the same issue today and don't really want to install an emulator
you need to add the browser platform to you app
cordova platform add browser
and point your browser to http://localhost:8000/browser/www/
When you're initially prompted with the javascript dialog boxes (e.g. gap: ["PluginManager",...]) you can press Cancel to get the app to load correctly.
After discussions on IRC with a Cordova developer, the serve command is somehow not well documented and it is mostly useful to serve content to the Phonegap App Developer mobile app that was released recently, and as far as I understand it now, it is now intented to serve the application for a regular desktop browser.
For desktop browser testing, I have been succesful until now with the Ripple emulator (not the Chrome plugin which seems unmaintened, but the NPM package).
For exemple you can test in the browser phonegap apps with:
npm install -g ripple-emulator
ripple emulate
This may help you: https://github.com/stample/gulp-browserify-react-phonegap-starter

Ruboto - On running rake-install start, app does not get powered up on emulator

With the basic setup done, when i run rake install start, i just get the build successful message and nothing beyond that. Nothing gets powered up in the emulator which is running on the side for me. I am just starting to write android apps using ruby and this is just a getting started app generated using ruboto gen app.
Here is what i get on running rake install start :
Sid:quick_start SID$ rake install start
/Users/SID/Documents/workspace/android_test/quick_start/src/quick_start_activity.rb changed.
Forcing rebuild of /Users/SID/Documents/workspace/android_test/quick_start/bin/QuickStart-debug.apk.
ant debug
Buildfile: /Users/SID/Documents/workspace/android_test/quick_start/build.xml
-set-mode-check:
-set-debug-files:
-check-env:
[checkenv] Android SDK Tools Revision 22.6.2
[checkenv] Installed at /Users/SID/android-sdk-macosx
-setup:
[echo] Project Name: QuickStart
[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 QuickStart...
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: /Users/SID/Documents/workspace/android_test/quick_start/bin/rsObj
[mkdir] Created dir: /Users/SID/Documents/workspace/android_test/quick_start/bin/rsLibs
[echo] ----------
[echo] Resolving Dependencies for QuickStart...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] No changes in the AndroidManifest files.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Found new input file
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.
-pre-compile:
-compile:
[javac] Compiling 1 source file to /Users/SID/Documents/workspace/android_test/quick_start/bin/classes
-post-compile:
-obfuscate:
-dex:
[dex] input: /Users/SID/Documents/workspace/android_test/quick_start/bin/classes
[dex] Found modified input file
[dex] Converting compiled files and external libraries into /Users/SID/Documents/workspace/android_test/quick_start/bin/classes.dex...
-crunch:
[crunch] Crunching PNG Files in source dir: /Users/SID/Documents/workspace/android_test/quick_start/res
[crunch] To destination dir: /Users/SID/Documents/workspace/android_test/quick_start/bin/res
[crunch] Crunched 0 PNG files to update cache
-package-resources:
[aapt] No changed resources or assets. QuickStart.ap_ remains untouched
-package:
[apkbuilder] Found modified input file
[apkbuilder] Creating QuickStart-debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
[zipalign] Running zip align on final apk...
[echo] Debug Package: /Users/SID/Documents/workspace/android_test/quick_start/bin/QuickStart-debug.apk
[propertyfile] Updating property file: /Users/SID/Documents/workspace/android_test/quick_start/bin/build.prop
[propertyfile] Updating property file: /Users/SID/Documents/workspace/android_test/quick_start/bin/build.prop
[propertyfile] Updating property file: /Users/SID/Documents/workspace/android_test/quick_start/bin/build.prop
[propertyfile] Updating property file: /Users/SID/Documents/workspace/android_test/quick_start/bin/build.prop
-post-build:
debug:
BUILD SUCCESSFUL
Total time: 7 seconds
And here are the modifications i made in the dx file:
# By default, give dx a max heap size of 1 gig. This can be overridden
# by using a "-J" option (see below).
defaultMx="-Xmx2048M"
defaultMx="-Xmx1024M"
Here is my avd which i setup :
Sid:quick_start SID$ android list avd
Available Android Virtual Devices:
Name: Android_4.4
Path: /Users/SID/.android/avd/Android_4.4.avd
Target: Android 4.4.2 (API level 19)
Tag/ABI: default/x86
Skin: WVGA800
Sdcard: 1000M
Please let me know if i am doing anything wrong.
Ideally,
rake install start should take me beyond build successful to something like this for instance and the app should be powered up on the emulator :
adb shell date -s 20131120.102437
Wed Nov 20 10:24:37 EST 2013
Installing package org.ruboto.example.quick_start
pkg: /data/local/tmp/QuickStart-debug.apk
Success
526 KB/s (74474 bytes in 0.138s)
This is a bug in Ruboto 1.0.3 and older, and only happens when deploying to Android 4.4 kitkat.
The bug has been fixed here: https://github.com/ruboto/ruboto/issues/585
You can apply the same change in your project to work around this bug.

Categories

Resources