How to create .apk from HelloWorld sample of Cocos2dx? - android

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.

Related

Cannot update project from terminal in Android

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 and Android Studio

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

Linphone Android how to import the library project?

I am working on SIP application and using Linphone Library.
I am trying to make and run the build on the device but getting few issues
I have setup the Android SDK and NDK set up on my Mac.
Now when i copy the repo via Terminal using command
$ git clone git://git.linphone.org/linphone-android.git --recursive
And than to Makefile ran this code:
$make
and Then it show's Build Successfull.
Now i need to import this project into Eclipse and when i do this imported project (folder named "linphone-adroid") into my Eclipse it shows me alot's of projects i am confused which one should i use and if i choose all of them then it gives me lot's of errors in other's (Shown in image below)
liblinphone-android --> Ran this on Device runs fine but when i call the numbers it changes it's view and shows duration 0:00 and does not calls the numbers then i have to press hang off button to dismiss the call. (Not able to make call's)
Please suggest me how should i import this project into my eclipse and what else scripts i need to run on the terminal to make it run.
So far what i have did is right or wrong?
Yes , it worked finally.
After build using "make" command.I installed in my device using "make install". Also generated sdk using "make linphone-sdk"
And then simply imported in eclispe just like normal android project.
Without any error it worked. - thank god.
In windows8 cygwin created many issues, so i did build the code using "make" command in MAC. And then simply imported in windows eclipse. (some admin permission issue in MAC)
Note: android-ndk-R9c was failed my build. So then i tried with android-ndk-R9 without additional toolchain it worked great. Android-ndk old versions available at
(http://page2rss.com/0dc3a880ab1762303011d69d18408917).
after building the library you have to import it in eclipse
File -> New -> Other... -> Android -> Android Project from Existing Code -> Browse_your_project
Now open your application (Project which have activity) and assign linphone library which you have earlier loaded....
Right click on your project -> select Android tab from left hand side -> from the bottom library section, click on "Add..." -> you will see the listed library which you have in your eclipse workspace -> select correct one -> click "OK" -> now refresh and clean the project -> build and try to run
check complete guide on linphone android on coders hub.
As suggested by #bhavana
I was doing wrong while importing the linphone-android project into my eclipse.
The correct process is explained below-
Importing into Eclipse :
After i have made the build then now i just need to import the project into eclipse.
Step1: Go to eclipse click on File Menu then Import then select
Existing Android Code into Workspace
Hit Next and Browse to the linphone-android project folder
And Only tick linohone-android folder and Leave copy project into workspace untick
Like the below image:
And hit finish.
Now i right clicked on "linphone-android" (project name) and go to Properties and Java Build Path and then Order and Export and then reorder them as my image below and untick gcm.jar
Hit OK
And Boom No errors
Now just run it on device or emulator. (Cross check minimum target SDK matches with the device or emulator.)
The above steps worked fine for me.

NDK Automatic build in eclipse OSX Invoking autoreconf in build directory:

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.

How to Compile Sample Code

I'm breaking into GUI programming with android, trying to compile and analyze Lunar Lander sample program. The instructions for using Eclipse say to select "Create project from existing source" but that option doesn't exist. If I select File->New->Project I can select "Java project from Existing Ant Buildfile". Using that I've tried selecting various xml files as "Ant Buildfile" but all give me the "The file selected is not a valid Ant buildfile" error.
I just want to run GUI sample projects, preferably with Eclipse. Any useful tips will be appreciated.
First of all you need to install Eclipse ADT plugin, here are the instructions http://developer.android.com/guide/developing/eclipse-adt.html.
Then you can import sample code in two ways:
File -> New -> Android Project, and choose "Create project from existing source"
If it is already an Eclipse project, click File -> Import, after that right click on the Project and choose Make it an Android Project
I read you prefer Eclipse, but you can always work from command line.
In a GNU/Linux system it's possible to do
$ cp -r $ANDROID_SDK/samples/android-15/LunarLander .
$ android update project --path LunarLander/ --target 3 --subprojects
$ cd LunarLander/
$ ant debug install
You have to choose the target according to your system.
It's possible to pick one id from the list you get with this command
$ android list targets
It should be File->New-> Android Project you need to select. Apparently, you didn't install Android SDK
In the past you can use "ant" to compile:
https://tthtlc.wordpress.com/2015/08/01/how-to-quickly-compile-all-the-android-samples-via-command-line/
But since June 2014, the SDK has been encouraging user to migrate to using gradle, but it is frauds with lots of problem. By June 2015, compilation has been mostly successful. Here are the steps:
https://tthtlc.wordpress.com/2015/10/30/how-to-build-android-sdk-samples-using-gradle/
And the full compilation of all the samples under the "android-22" branch: I have 84 successful and 19 failures.
The full logs is available here:
http://pastebin.com/33JBDAqj

Categories

Resources