I'm very new to cocos2d-x development, and I also never built anything on Android.
I followed many text guides that seem to be outdated and not using Android Studio, but Eclipse instead as an IDE. I downloaded all required components (NDK, Ant, JDK), and I'm not sure where to use them in this IDE itself. When I built on iOS, my project worked just fine. When it was time to test it on Android, I followed this video guide http://www.youtube.com/watch?v=VLeGy1foMQA . My project kept crashing with "Unfortunately, projectname has stopped" message. Compiler never showed anything resembling an error report (or something that looks like one).
I'm very confused right now. Someone please give me a step-by-step guide on how to compile cocos2d-x projects on Android (I'm using a Mac).
You don't need a IDE to compile cocos2d-x projects on Android. You just have to use a command like:
cocos compile -s /your_cocos_project_path -p android -o /your_cocos_output_path
If you want to load your Android project in a IDE, you should have the following folders in your cocos2d-x project:
proj.android
proj.android-studio
proj.ios_mac
...
For Eclipse you can import the project from proj.android folder and for Android Studio from proj.android-studio.
Then if you want to generate the apk from proj.android just execute the command that I wrote at the beginning. If you want to generate the apk from proj.android-studio, execute a command like:
cocos compile -s /your_cocos_project_path -p android --android-studio -o /your_cocos_output_path
Related
I am developing an Android project. In my project, I need to do OCR. So found this tutorial http://www.codeproject.com/Tips/840623/Android-Character-Recognition. I am trying to follow that tutorial. But I am having problems with set up, especially with updating project from terminal (tess-two folder). See what I have done below.
I downloaded tess-two from this link
https://github.com/rmtheis/tess-two/
Then I installed android NDK to build that project
I set environment variable under PATH
Then I run below command in tess two folder from terminal
ndk-build //this took around 30 minutes. I closed command windows after successful built
Then I run this command
android update project --path C:\tess-two-master\tess-two
The problem starts when I run that command because I cannot run android command from terminal. So I found solution from Stack Overflow. I needed to set ANDROID_HOME and environments variable under PATH. Then I tested "android" command and it is working.
Then I run this command again
android update project --path C:\tess-two-master\tess-two
This time, it is giving me this error
How can I solve this error? Why my update command is not working? What is wrong with my code? I am using Windows 64 OS.
This is another way. Installing using Grandle
I tried another way to install tess-two. I installed using Gradle like this according to documentation. But I cannot access to TessDataManager because it cannot be found in project.
Gradle
dependencies {
compile 'com.rmtheis:tess-two:6.0.2'
}
This is error
As you can see, I cannot access to TessDataManager class. How can I import that class?
The tess-two project has been updated to include a pre-compliled AAR that can be incorporated into your app by editing your app's build.gradle file.
This means that you can skip the steps of importing/compiling the library yourself, and follow the usage instructions on the tess-two project. After following the usage instructions, you'll be able to refer to the tess-two classes -- including the TessBaseAPI class -- directly from your project.
cocos2d-x V3.7 supports Android Studio, but I'm unable to run even the test app. Everytime I deploy the app on my Android device and try to run, my device gives and error "Unfortunately, libcocos2dx has stopped". I think I'm doing it the wrong way. Can anyone guide me with how to run the project properly?
Android Studio cant build with ndk yet, so what i do, is import proj.android on Android Studio, and then compile in console in the root of you project:
Cocos compile -p android
And now you can Debug and install the apk file on android studio, just click debug and play, no more crashes, but if you modify any file ,you need to compile again in cocos console, and install the apk again VIA Android studio Debug.
break point work in java file in android studio.break point in cpp file is not consider in debug.Try to debug build_native.sh file in console and then run your project
I am using Windows 7 x64, cygwin, Eclipse Juno cpp, jre6, android ndk r8b, latest cocos2dx for windows. I have tried this tutorial link.
http://www.cnblogs.com/ybgame/archive/2012/06/07/2540693.html
I have overcome the error. But unfortunately, the Eclipse builder don't generate the .apk file. The console's output is here:
Notice that, there is no "make" command called. This is different from the tutorial link above, where the last part of tutorial, the console's output is showing the make command called.
right click on your Eclipse Project -> Android Tools-> Export signed (or unsigned) Application Package
compile the project in msys or cygwin and then import/ create project from source and give a name. click on the run button.you will notice the project run on emulator all is set . good luck.
this time with a droid related question.
Im running Eclipse Helios and Mac OS X 10.6.8
I have been following a book and a few tutorials on building the NDK from both command line and Eclipse.
I am copying the source over there is no static library business. I can compile from the command line fine with the "ndk-build" executable and it works fine.
Though i need to compile inside Eclipse for the reasons i don't need to go into here.
Ive tried 2 techniques and the one i have seen working is to convert my Project to a c++ project and then in Project / Properties / c/c++ Build tab / Build Command i set to ndk-build , this is set to be visible in my path (hence why it compiles when i go to directory and use ndk-build from Terminal)
I then in the C/C++ General tab add the following locations as include directories :
/Users/Me/Code/Android/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/include
/Users/me/Code/Android/android-ndk-r7b/platforms/android-9/arch-arm/usr/include
/Users/me/Code/Android/android-ndk-r7b/sources/android/native_app_glue
Then when i go to compile i don't get any out put i just get the following error:
Invoking autoreconf in build directory: /Users/me/Code/Android/DroidBlaster
sh -c autoreconf -i
autoreconf: `configure.ac' or `configure.in' is required
Configuration failed with error
Ive tried a few other tutorials but to no avail, if i could award a bounty on this is would as its urgent i get this fixed.
Cheers community :)
NOTE:
Ive worked out that it is using auto tools to build the project where this is incorrect as i should be building with the NDK , getting closer to an answer hopefully. Seems that i cant convert my Android project with CDT to a custom build configuration, might be a bug to do with Eclipse, trying a fresh install
Ok so i worked it out, it was because i was trying to compile using Auto tools when i should have set up the project when i should have been using "Convert to C/C++ project" didn't help though that eclipse installed CDT incorrectly and i had to reinstall to get the right plugins.
I am trying to compile the binary dosfsck and mkdosfs for Android, using Linux and Android NDK and SDK. I've setup NDK and SDK properly, the path to the NDK gcc is in my path. I've also downloaded the correct SDK for my device (HTC Desire).
I first tried compiling the file with a simple make:
make
CROSS_COMPILE=/home/droidzone/android/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
I need to be able to run the binary from my device. As it is, the app compiles and runs on Ubuntu, but not my device. I get the error message from sh: Cannot run binary
Could someone please explain how I can link libraries, where I should get them from (within the SDK) and what changes if any to make to the Makefile, and the final syntax to compile this properly for Android
I found this was easiest to do using the agcc script script which you can use by exporting CC=agcc. Lots of projects will not properly support CROSS_COMPILE as you have tried. The agcc script is oriented around using the Android build tree files so I modified it to use the NDK tools. With this you should be able to build most things using make CC=agcc or CC=agcc ./configure