phonegap android sample project not building - android

I'm trying to follow the setup instructions on phonegap-android's wiki page, but I'm having trouble. I've got all of the prereqs/path variables/etc set-up, but when I execute the command (in gitbash as per the instructions) for building the project, I get errors which I do not understand.
Here is the script which I run:
$ ruby ./droidgap "C:/android-sdk-windows" pgtest com.example.android.pgtest "C
:/xfer/input" "C:/xfer/output"
and here is the result I get:
Building the JAR...
'/*' is not recognized as an internal or external command,
operable program or batch file.
'Licensed' is not recognized as an internal or external command,
operable program or batch file.
'contributor' is not recognized as an internal or external command,
operable program or batch file.
'this' is not recognized as an internal or external command,
operable program or batch file.
'The' is not recognized as an internal or external command,
operable program or batch file.
you was unexpected at this time.
Creating Android project for target level 8
Adding www folder to project...
Generating manifest...
Copying over libraries and assets and creating phonegap.js...
c:/Ruby192/lib/ruby/1.9.1/fileutils.rb:1418:in stat': No such file or directory
- c:/Users/<user>/Desktop/phonegap/framework/phonegap.jar (Errno::ENO
ENT)
from c:/Ruby192/lib/ruby/1.9.1/fileutils.rb:1418:inblock in fu_each_sr
c_dest'
from c:/Ruby192/lib/ruby/1.9.1/fileutils.rb:1432:in fu_each_src_dest0'
from c:/Ruby192/lib/ruby/1.9.1/fileutils.rb:1416:infu_each_src_dest'
from c:/Ruby192/lib/ruby/1.9.1/fileutils.rb:391:in cp'
from ./droidgap:82:incopy_libs'
from ./droidgap:20:in run'
from ./droidgap:157:in'
I've looked through the phonegap forums, and I've found some hits on part of the error (the part where phonegap.jar could not be found), but nothing on the first part ("_ is not recognized", etc.). What am I doing wrong? Thanks.
Additional info:
-Windows 7 (32 bit)
-ruby 1.9.1
-java jdk1.6.0_21
-ant 1.8.1

Got it working. I remembered reading that windows users sometimes needed to add ".bat" to the end of certain commands, so I changed ant to ant.bat in the droidgap script and it worked.
Also, this guy had the same issue as me and I somehow missed it.

I've had various problems with building the Example PhoneGap App (http://wiki.phonegap.com/w/page/16494774/Getting-started-with-Android-PhoneGap-in-Eclipse)
Some of the error messagesI had are:
- in `': No such file or directory - android-sdk-path.bat android.bat (Errno::ENOENT)
- instat': No such file or directory - ~/projects/phonegap-android/framework/phonegap.jar
BUT IT'S NOW FIXED!!!
To fix the issues I had to tweak a lot of things , so I'm not too sure which one fixed what, but here's my system in the end (note: I'm on Windows Vista)
COMPATIBLE versions
- apache ant 1.8.2
- Ruby 1.8.7
- Java SDK 1.6
- Git Bash 1.7.3.1
Environment Variables:
- ANDROID_HOME = \android-sdk-windows
- ANT_HOME = \apache-ant-1.8.2
- JAVA_HOME = \jdk1.6.0_13
- RUBY_HOME = \Ruby187
- PHONEGAP_ANDROID = \phonegap-android
- Path - add these %JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%RUBY_HOME%
\bin;%PHONEGAP_ANDROID%\bin
Using Git Bash - use NEW METHOD - ruby bin/droidgap create example
RESULT: successfully created two outputs; a file called 'PhoneGap.jar' and an Android Eclipse project to be imported into Eclipse
Hope this helps

Related

How to build boost 1.69.0 for Android with NDK r18b using dec1/Boost-for-Android?

I tried to use https://github.com/dec1/Boost-for-Android to compile boost for Android. It reports 1.69.0 is supported for NDK r18b. I'm under Windows 7.
Even if this is reported as working, I encounter many problems when trying to run the provided script:
Downloaded boost 1.69.0
Downloaded sources
Modified BOOST_SRC_DIR to point to folder containing "1.69.0" boost folder
Modified ANDROID_NDK_ROOT to point to ndk folder
Modified ABIS="armeabi-v7a,x86"
Modified LINKAGE="static"
Added Cygwin to my path (as this is a .sh file I need to run)
Ran doIt.sh
Got non blocking errors:
-nLe fichier sp?cifi? est introuvable.
ERROR: Unsupported HOST_TAG: windows-x86_64
Then I got final error
## COMMAND: mkdir /tmp/ndk-/tmp/build-11600/build-boost/armeabi-v7a/llvm/host-bin
## COMMAND: ./bootstrap.sh --with-toolset=cc Building Boost.Build engine
with toolset cc... Failed to build Boost.Build build engine Consult
'bootstrap.log' for more details ERROR: Could not bootstrap Boost build
'bootstrap.log'reports gcc: not found
Added MinGW to my PATH (to have gcc be found), then retried:
Now I get in 'bootstrap.log':
cc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c pathunix.c
command.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
There is no 'cc' available in my PATH, dunno where this is supposed to be found
Any idea what I may be doing wrong?
Sorry, only building on linux is officially supported. Mac and Windows should work fine too but details of setting up the relevant environments (eg cgwin or homebrew) is beyond the scope of what this project tries to do.
If you want to use windows as a host you have two easiest options are:
Use virtual machines eg. VirtualBox or and create a linux virtual machine where you do the building.
You can also simply download and use the precompiled binaries I have made available
No matter what os you use to build under, the resulting binaries can then be copied to windows and used from then on as if you had built on windows to start with (theyre cross compiled for android).

Issue in Linking a C Library compiled with CMake in Android.

I am building a daemon on Android Platform. For which I have cross compiled the existing code, which is present in Linux to Android. Please consider my below 2 cases -
I cross compile the code using Cmake with Android NDK-15 and push manually to the board on which Android Code is available. The path in which we push is /system/lib. Then if I try to execute my daemon (which is also pushed manually to /system/bin ) everything works fine.
But,
2 The cross compiled library have been pushed into the AOSP code by writing an Android.mk file written in vendor specific folder. I have used BUILD_PREBUILTS method and was successfully able to push the libraries to /system/lib. Now, when I try to execute my application (Compiled with CMake ) I get a linker error.
Below is the error which I get ( Reference Example ) -
Below is the folder structure -
Total Number of folders - 3
a. abc folder which produces output libabc.so and links to libdef.so and
libghi.so
b. def folder which produces output libdef.so
c. ghi folder which produces output libghi.so
When I push all the 3 libraries (libabc.so, libdef.so, libghi.so ) directly in /system/lib and my executable (drive_test) which links all the 3 libraries, I have no issue. But, when I push it along with AOSP build I get the following error on execution of the executable (drive_test) -
a. Unable to link ../abc/def.so file.
I am unable to debug how to solve this linker issue. I am not getting whether it is because of CMake (or) any other issue.
If you're trying to make a system daemon (something that goes in /system/bin), don't use the NDK. Just use the AOSP build system.
In mydaemon/Android.bp (make sure to add this path to the root Android.bp file):
cc_library {
name: "libmylib",
srcs: ["mylib.cpp"],
}
cc_binary {
name: "mydaemon",
srcs: ["mydaemon.cpp"],
shared_libs: ["libmylib"],
}
The build system will deal with getting libraries and binaries into the right place for you.

cocos2dx error Build dynamic library for project failed

'cocos' is not recognized as an internal or external command, operable program or batch file.
E:\cocos2d-x-3.14.1\build>python android-build.py -p 21 cpp-tests
Is your cocos is configure correctly? Try this, Open your cmd(command prompt) and type cocos
enter image description here
cmd not recognize cocos because cocos2d-x-3.14.1\tools\cocos2d-console\bin folder is not exist into environment path variable.
run python setup.py from your cocos2d-x-3.14.1 folder, before building test project.
setup.py set required Environment Variables, if already set then good otherwise prompt to set required NDK_ROOT, ANDROID_SDK_ROOT, ANT_ROOT, COCOS_CONSOLE_ROOT, COCOS_X_ROOT, COCOS_TEMPLETS_ROOT
COCOS_CONSOLE_ROOT is path to cocos2d-x-3.14.1\tools\cocos2d-console\bin
bin folder containing cocos.bat file that run cocos.py script
try this
switch from ndk9b to ndk9d.
the recent version of cocos2dx made a switch from ndk9b to ndk9d.
i hope thats helpfull for you

Can't run PhoneGap's create command

I am trying to setup a basic "hello world" PhoneGap project. I've been walking through the steps found at http://docs.phonegap.com/en/2.7.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android. I am doing this on a Windows 7 Ultimate machine.
I have successfully setup Java and Ant. I have confirmed this by typing "javac -version" in a command prompt (1.6.0_39 is shown). When I type "ant" in a command prompt, I receive a message that says "Buildfile: build.xml does not exist! Build failed". At this point, I'm confident I've done everything properly through step 3. However, when I get to step 4, I run into issues.
On step 4 when I type "create C:\Tests\Android Test MyNamespace.Test.Android" in a command prompt, I receive an error that says: "create is not recognized as an internal or external command, operable program or batch file.". What could be wrong? Where does "create" come from? I'm in the /Cordova/phonegap-2.7.0/phonegap-2.7.0/lib/android directory when I run the command, I receive the following error:
Creating new android project...
Copying template files...
Copying js, jar & config.xml files...
Copying cordova command tools...
Updating AndroidManifest.xml and Main Activity...
C:\Program Files\Cordova\phonegap-2.7.0\phonegap-2.7.0\lib\android\bin\create.js
(31, 5) Microsoft JScript runtime error: Path not found
I can see the create.js file. However, for some reason I'm getting this "Path not found" error. Did I enter an incorrect command prompt parameter? I keep staring at it and everything looks correct.
Thank you!
Same problem here...
Strangely if I run the comand "Create" with no parameters, it creates a folder "example" with a sample app, without the error
I found the answer in: https://groups.google.com/d/msg/phonegap/tnz2DnUE-E0/ADZibhwHGpYJ
The problem is with this line in "create.js":
var ACTIVITY_PATH=PROJECT_PATH+'\\src\\'+PACKAGE_AS_PATH+'\\'+ACTIVITY+'.java';
[...]
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\project\\Activity.java '+ ACTIVITY_PATH +' /Y');
The Windows "copy" command will not create directories that don't exist, so the command above fails because "src\PACKAGE_AS_PATH" doesn't exist. This can be fixed with:
var ACTIVITY_DIR=PROJECT_PATH + '\\src\\' + PACKAGE_AS_PATH;
var ACTIVITY_PATH=ACTIVITY_DIR+'\\'+ACTIVITY+'.java';
[...]
exec('%comspec% /c mkdir ' + ACTIVITY_DIR);
exec('%comspec% /c copy "' + ROOT + '"\\bin\\templates\\project\\Activity.java ' + ACTIVITY_PATH + ' /Y');
Check your environment path:
Set Environment variables:
Path:
Start -> Control Panel -> System and Security -> System -> Environment variables
Or
Mycomputer -> Right Click -> properties -> Advance System settings -> Environment variables
1. Java JDK
2. Android SDK
3. ANT
User variables for user1:
Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Users\user1\AppData\Roaming\npm\
Temp:
%USERPROFILE%\AppData\Local\Temp
System variables:
ANDROID_HOME: C:\Nithi\software\Android_sdk\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\
Path:
ANT_HOME: C:\ant
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_45\
JAVA_PATH: C:\Program Files (x86)\Java\jre7\bin
Path: c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;%ANT_HOME%\bin;%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
is your Environment variables set for JAVA and ANT? Also, can you share the create command you are using? There should be no spaces in package names.
You should be in Cordova/phonegap-2.7.0/phonegap-2.7.0/lib/android/bin directory. Then type:
create {path} {project.with.dots} {YourProjectName}.
For example, I just ran:
C:\server\cordova\phonegap-2.7.0\phonegap-2.7.0\lib\android\bin> create ../MyTest my.test.com MyTestProject and it created MyTest folder in C:\server\cordova\phonegap-2.7.0\phonegap-2.7.0\lib\android\.
Also, if you do echo %PATH%, you should see the directories to your ant\bin, android-sdk\tools, android-sdk\platform0tools, and %JAVA_HOME%.
I think you should put your path to the project directory in "" otherwise the create script will interpret "Test" as the package name, which is obviously not a valid package name.
So command should read:
create "C:\Tests\Android Test" MyNamespace.Test.Android AndroidTest
It looks like the project name cannot have dots in it.
C:\Phonegap\android\bin>create c:\android\helloworld3 com.hello.world helloworld
Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft
Corporation. All rights reserved.
C:\Phonegap\android\VERSION Creating new android project... Copying
template files... Copying js, jar & config.xml files... Copying
cordova command tools... Updating AndroidManifest.xml and Main
Activity... c:\android\helloworld3\src\com\hello\world\helloworld.java
c:\android\helloworld3\src\com\hello\world\helloworld.java
c:\android\helloworld3\AndroidManifest.xml
c:\android\helloworld3\AndroidManifest.xml
c:\android\helloworld3\AndroidManifest.xml
(works ok)
But...
C:\Phonegap\android\bin>create c:\android\helloworld4 com.hello.world hello.world
Microsoft (R) Windows Script Host Version 5.8 Copyright
(C) Microsoft Corporation. All rights reserved.
C:\Phonegap\android\VERSION Creating new android project... Copying
template files... Copying js, jar & config.xml files... Copying
cordova command tools... Updating AndroidManifest.xml and Main
Activity...
c:\android\helloworld4\src\com\hello\world\hello.world.java
C:\Phonegap\android\bin\create.js(32, 5) Microsoft JScript runtime
error: Path not found
(fails)
Unhelpful error message though.

How to build i686-linux-android-gfortran for android-ndk8b (x86 arch Android)?

I tried building i686-linux-android-gfortran using build-gcc.sh following this
(it's for androdindk-7b) but I get error about link.h. I added link.h from here, but it gives further more errors.
Has anyone tried enabling i686-linux-android-gfortran for x86 Android?
From https://groups.google.com/forum/#!msg/android-ndk/QR1qiN0jIpE/g0MHkhTd4YMJ as selalerer suggested. I didn't try this, so I'm posting as a community wiki for reference purposes.
Fortran for x86 Android
=================
The guide is based on this one, many thanks to Phil:
Compiling Android NDK with Objective-C-enabled gcc errors
1) Download and unpack Android NDK 'android-ndk-r8c', (the older -r8b NDK won't work due to missing link.h!):
wget http://dl.google.com/android/ndk/android-ndk-r8c-linux-x86.tar.bz2
2) Create somewhere a folder called 'toolchain-src' (e.g. inside the folder android-ndk-r8c),
'cd' to this new folder
3) Make sure to have git installed ('yum install git' or whatever..) and download
the toolchain sources:
git clone https://android.googlesource.com/toolchain/build.git
git clone https://android.googlesource.com/toolchain/gmp.git
git clone https://android.googlesource.com/toolchain/gdb.git
git clone https://android.googlesource.com/toolchain/mpc.git
git clone https://android.googlesource.com/toolchain/mpfr.git
git clone https://android.googlesource.com/toolchain/expat.git
4) Create the folder 'binutils', 'cd' to this directory, unpack
binutils-2.23 there:
wget ftp.gnu.org/gnu/binutils/binutils-2.23.tar.gz
tar -xvzf binutils-2.23.tar.gz
You should now have a folder toolchain-src/binutils/binutils-2.23
5) Change to folder toolchain-src/build, edit the Makefile.in, changing the line:
--with-gnu-as --with-gnu-ld --enable-languages=c,c++
to
--with-gnu-as --with-gnu-ld --enable-languages=c,c++,fortran
6) In the file android-ndk-r8c/build/tools/build-mingw64-toolchain.sh change the line:
var_append GCC_CONFIGURE_OPTIONS "--enable-languages=c,c++"
to
var_append GCC_CONFIGURE_OPTIONS "--enable-languages=c,c++,fortran"
7) In the file android-ndk-r8c/build/tools/build-gcc.sh, change the line:
EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --disable-libquadmath --disable-plugin"
to
EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --disable-libquadmath --disable-libquadmath-support --disable-plugin"
8) In the file android-ndk-r8c/build/tools/build-host-gcc.sh, change the line:
ARGS=$ARGS" --enable-languages=c,c++"
to
ARGS=$ARGS" --enable-languages=c,c++,fortran"
And change the line
ARGS=$ARGS" --disable-libquadmath --disable-plugin --disable-libitm --disable-bootstrap"
to
ARGS=$ARGS" --disable-libquadmath --disable-libquadmath-support --disable-plugin --disable-libitm --disable-bootstrap"
9) Build your new toolchain:
/your/path/to/android-ndk-r8c/build/tools/build-gcc.sh -j1 --gmp-version=5.0.5 --mpfr-version=2.4.2 --mpc-version=0.8.1 --binutils-version=2.23 --gdb-version=7.3.x /your/path/to/toolchain-src /your/path/to/android-ndk-r8c x86-4.7
(don't worry about messages like 'expr: warning: unportable BRE:')
10) And go down to your knees in front of the screen, praying to the Lord that somehow these
countless configure scripts doing checks that nobody needs, using an ugly shell language
that cooks your brain with indentation going from right to left, will somehow manage to
compile a zillion of far too small files (so that 10% of the time is spent on compilation
and 90% on starting up GCC), and after an hour of watching progress with
tail -F /tmp/ndk-YourUserName/build/toolchain/config.log
your toolchain will be magically ready. You'll find it in the android-ndk-r8c/toolchains folder.
11) Finally, 'cd' to the folder
'/your/path/to/android-ndk-r8c/toolchains/x86-4.7/prebuilt/linux-x86/i686-linux-android'
and run this command:
ln -s ../libexec libexec
Without this command, it may happen that g++ raises the error message
"g++: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found".
Using strace, I found that g++ looks in the wrong folder, but the link
above lets it find the file liblto_plugin.so nevertheless.
And here are a few lessons learned on the way, so that Google finds this page:
*) To speed up the compilation, you can remove the '-j1'. But only after you got
it to work once, since building in parallel on multiple CPU cores was reported to
cause additional troubles.
*) The error message "Link tests are not allowed after GCC_NO_EXECUTABLES" shows up
when linking fails for x86 (works for ARM). The reason is that GCC does not include
the proper ANDROID_STARTFILE_SPEC and ANDROID_ENDFILE_SPEC from
gcc-4.6.1/gcc/config/linux-android.h. GCC 4.6.1 only specifies them for ARM, but not
for i386, GCC 4.8.0 however does. The GCCs downloaded from Google also do,
so best use Google's GCC.
*) The error message "fatal error: link.h: No such file or directory" also happens
with Google's GCC, and apparently (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50877)
only when you enable additional languages like objc or fortran.
The bug thread is here: http://gcc.gnu.org/ml/gcc-bugs/2012-08/msg00494.html
MIPS has link.h in android-ndk-r8b/platforms/android-9/arch-mips/usr/include
In android-ndk-r8c, link.h is now also present in android-9/arch-x86/usr/include/link.h,
so this bug was fixed.
*) The error message "fatal error: quadmath_weak.h: No such file or directory":
It also happens with the latest gcc-4.8, so we can just continue using Googles GCC 4.7.
Google itself uses --disable-libquadmath, but we additionally need --disable-libquadmathsupport
(see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47648). So this needs to be added in
android-ndk-r8c/build/tools/build-gcc.sh
and
android-ndk-r8c/build/tools/build-host-gcc.sh
*) The error message "error: Pthreads are required to build libatomic"
Happens when building the ARM version of gcc-4.8 downloaded from gnu.org,
better stay with Google's GCCs.
*) The GCC that came with android-ndk-r8c didn't work for me (error message about
libstdc++.so.6 being too old), while the one in android-ndk-r8b worked
without problems. Since the android-ndk should support as many environments
as possible, I'm not sure why the Googlers decided to depend on a newer libstdc++,
but the good news are that building your own toolchain solves the issue.
*) If you get an error while compiling generic-morestack.c, then replace
#ifdef linux
// On Linux, the first two real time signals are used by the NPTL
with
#if defined(GLIBC) && defined(linux)
// On Linux, the first two real time signals are used by the NPTL

Categories

Resources