How to setup cocos2dx for android on MacOs Lion? - android

I am trying to setup cocos2dx with eclipse on a MacOs Lion. I am following the tutorial below:
http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started
When I try and execute the ndk build shell tool i get the following error:
Davids-iMac:~ davidcavanagh$ /Users/davidcavanagh/Downloads/android-ndk-r8b/ndk-build ;
exit;
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/Users/davidcavanagh/Downloads/android-ndk-r8b/build/core/build-local.mk:130: *** Android
NDK: Aborting . Stop.
logout
[Process completed]
I have tried defining the NDK_PROJECT_PATH through the terminal by using
export NDK_PROJECT_PATH=/Users/davidcavanagh/Downloads/android-ndk-r8b/
This doesn't work. Can anyone help me as I have been stuck on this for ages. Is there a certain way of setting the path that I am not doing?
Thanks

Re-read and re-read again his tutorial. You shouldn't be executing the ndk-build script without supplying the arguments it needs for building your project.
He mentions using the create-android-project.sh script inside the cocos2d-x directory. Make sure you do that, and follow the steps there where you'll supply the project name, reverse-domain application ID (e.g. com.company.project), and so on. This will generate your project directory inside of the cocos2d-x directory, which you can easily & safely move to another location.
Once you have that project set up, you can import it into Eclipse, which, primarily, allows you to build the Android project, but does not refer to the C++ code directly. (You'd need to get CDT and the NDK plugin to actually hook your C++ code up inside of Eclipse).
Otherwise, what's worked for me so far is to run the build_native.sh script inside the project directory whenever I have new code that I want to test on my device. This script references the jni/Android.mk file, where you need to specify your header paths and *.cpp files (similar to how you'd have to specify all of your implementation files with g++ on the command line).
But before you do that, you need to make sure all the environment variables that build_native.sh uses are set up. You can either put them in your ~/.bashrc file, or you can just stick them in that project directory (up to you. bashrc will make them available to all projects whenever you launch a new terminal, whereas hardcoding them into build_native.sh will only offer them to that specific project). I think all you need is to assign the full paths to NDK_ROOT, COCOS2DX_ROOT, and APP_ROOT, and build_native.sh should run successfully.
If you look down at the bottom of build_native.sh, you'll notice an invocation of ndk-build, along with all the necessary parameters that you were missing in your terminal session.

Related

Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK

I am trying to install the mqtt module to android_armv7. To do this, I create a folder named build and run this: ~/Qt/5.12.4/android_armv7/bin/qmake qmake -r ... Unfortunately I recieve this error:
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/stefan/Qt/5.12.4/android_armv7/mkspecs/android-clang/qmake.conf.
Error processing project file: ../qtmqtt.pro
I have tried going to tools->External->Configure->Environment->External Tools->Update Translations and wrote:
"ANDROID_NDK_ROOT=/home/stefan/Downloads/android-ndk-r19c/android-ndk-r19c
PATH="
in the Environment Change section. It didn't work. A strange thing (for me) is that I can deploy an application (without mqtt) on android_armv7. I am using Linux. What should I do now?

Tesseract OCR Android in Windows

I've read all of questions forums and blogs about it but i still have a problem. Firstly, i ticked tess-two as a library also my project's using tess-two as a library. I downloaded Android-NDK and from my project's properties i clicked Builders and then new -> Program then i choose ndk's ndk-build file. By the way my project is Gautam Gupta's project. He'd given project. Link: https://github.com/GautamGupta/Simple-Android-OCR. When i run that project in my phone, application starts and captures photo but when i press save then application gives error below. http://t1307.hizliresim.com/1c/l/qg0rl.png
Looks like you need to download only TessTwo, make sure you have properly setup the environments variables (ANT_HOME, ANDROID_HOME and ANDROID_NDK) so these point to where you have Ant and Android SDKs.
Then it's a matter of building the project by following TessTwo guidance. That you set up the library-project that can be imported.
Don't forget that the line commands must be performed in CygWin. Once the library project is built you should have correct .so files in libs/*. In order to actually use these, you could start with this link.
#Burak:
I have solved my problem. For Windows;
Write the codes below to Cygwin
a.cd <project-path'i>/tess-two
b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
c.export LEPTONICA_PATH=${PWD}/external/leptonica-1.68
d.export LIBJPEG_PATH=${PWD}/external/libjpeg
e./cygdrive/<ndk-directory>/ndk-build
Write the codes below to CMD
f.android update project --target 1 --path .
g. ant release
Don't forget the "." at step f.

How to building and running apjsua sample application

I wanted to try PJSIP on an Android AVD.
I performed the following steps :
Now, the next step says :
Building and running apjsua sample application
We have apjsua sample application located under pjsip-apps/src/apjsua. It is not built by default, and you need SWIG to build it.
Follow these steps to build apjsua:
Make sure SWIG is in the build environment PATH. Alternatively, update
SWIG path in $PJDIR/pjsip-apps/src/apjsua/jni/Android.mk file. Run
ndk-build from directory $PJDIR/pjsip-apps/src/apjsua, note that the
Android NDK root should be in the PATH, e.g:
Create Android project from apjsua. In Eclipse: From menu: File -->
New --> Project Select Android Project from Existing Code, press Next
In Root Directory, put the location of apjsua source code (i.e.
$PJDIR/pjsip-apps/src/apjsua) and press Finish You may need to select
different Android SDK than what is configured in apjsua. You can do
this from the project's Properties. You can modify
apjsua/res/raw/config.txt for apjsua's config file. Run it.
My question is :
How to use swig? I am very confused.
Don't worry about swig. You should compile it, and add it to the environment path.
ndk-build will call swig application. You can add it to the PATH by typing in terminal
PATH=$PATH:/path/to/swig , where /path/to/swig is location on your computer of swig app.

Ant Build Android Project With Dependencies

I'm trying to build an app (let's call it android-app) with a dependency on an SDK (let's call it sdk) via Ant. Eclipse is not installed on this computer (for reasoning, it's a CI box with Jenkins).
Both projects are in two completely separate directories side by side. android-app is in the directory ~/.jenkins/jobs/android-app/workspace and sdk is in the directory ~/.jenkins/jobs/sdk/workspace.
Let's assume both projects are "vanilla" and have not been built with Ant before. I cd to the ../android-app/workspace directory and run android update project -p . --library ~/.jenkins/jobs/sdk/workspace which passes. I then cd to the ../sdk/workspace directory and run android update project -p . which also passes.
At this point I cd back to the ../android-app/workspace directory and run ant clean build. It fails with the error:
BUILD FAILED
/path/to/ant/build.xml:440:
/path/to/sdk/workspace resolve to a path with no project.properties file for
project /path/to/android-app/workspace
... where /path/to is the full path to the directories. I simplified it here.
If I cd to the sdk workspace and open project.properties, I receive the following:
# ProGuard
proguard.config=proguard.cfg
# Project target.
target=android-10
android.library=true
It does exist. So do all of these files:
So, why is this failing? What am I doing wrong? I tried to provide as many details as possible. Please let me know if I can provide anything additional.
Well, I encounter this problem too.
I use strace to find out what the hell is going on and found that the path you specified in project.properties will be appended with your current folder path as its prefix.
For example,
/home/myfolder/project > ant debug
And the library you specified in project.properties is /path/to/library
Then, the path will become
/home/myfolder/project/path/to/library
Just to fill in the answer gap here, my Java version was completely off. I'm super embarrassed.

Android NDK: ndk-build script fails - script "check-cygwin-make.mk" not found

I'm new to development with the NDK of Android.
As I'm developing on Win7 I installed Cygwin in order to build the native binaries.
When running ndk-build from the project folder /home/simon/ndk/hello-neon I get the error
ERROR: You are using a non-Cygwin compatible Make program.
Currently using: C:/Programs/cygwin/bin/make
To solve the issue, follow these steps:
1. Ensure that the Cygwin 'make' package is installed.
NOTE: You will need GNU Make 3.81 or later!
2. Define the GNUMAKE environment variable to point to it, as in:
export GNUMAKE=/usr/bin/make
3. Call 'ndk-build' again.
The problem that stops me now is that the ndk-build script seems not to be able to call the check-cygwin-make.mk script in the following lines:
GNUMAKE=`cygpath -u $GNUMAKE`
PROGDIR_MIXED=`cygpath -m $PROGDIR`
CYGWIN_GNUMAKE=`$GNUMAKE -f "$PROGDIR_MIXED/build/core/check-cygwin-make.mk" 2>&1`
When calling
echo $CYGWIN_GNUMAKE
I get the reply:
make: C:/Programs/cygwin/home/simon/build/core/check-cygwin-make.mk: No such fil
e or directory make: AndroidManifest.xml build.properties default.properties jni
res src No rule to make target `C:/Programs/cygwin/home/simon/build/core/check-
cygwin-make.mk'. Stop.
Now I'm lost because I don't understand the role of the check-cygwin-make.mk script and I could not find it anywhere on my drive.
I'm aware of the problem with spaces in the C:/Program Files/ folder name, and I think this is not problem now.
I hope someone can help my to solve this issue,
Regards,
Simon
Install android-ndk and cygwin(with "make" support command) then set the varaibles like this
Right-click My Computer, and then click Properties.
Click the Advanced tab.
Click Environment variables.
then edit"PATH" add this line
C:\cygwin\bin like this
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files......;C:\cygwin\bin
then try with your built steps
'check-cygwin-make.mk' is in '\android-ndk-r6b\build\core', and you should have installed Android NDK to a directory without spaces in the path.
Next you should be running ndk-build either from Cygwin-shell, or with the command 'bash -c ndk-build'.
And of course the necessary paths both to Cygwin binaries (as in the previous answer), and to ndk-build should be specified in PATH.

Categories

Resources