Been at this for three nights, hoping one of you android experts can assist me.
I have the orx SVN, the Android SDK, the Android NDK, eclipse, ADT and Cygwin.
I have been trying the following method:
1) Start Cygwin
2) $ cd /cygdrive/c/Work/Downloads/Dev/orxsvn/code/build/android-native/
My ndk-build is obviously installed elsewhere so I need to execute it with:
3) $ /cygdrive/c/Work/Downloads/Dev/android-ndk-r8b-windows/android-ndk-r8b/ndk-build
I get the following error:
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/c/Work/Downloads/Dev/android-ndk-r8b-windows/android-ndk-r8b/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
So I need to define the project path even though I am currently in the project path:
4) NDK_PROJECT_PATH=/cygdrive/c/Work/Downloads/Dev/orxsvn/code/build/android-native
5) export NDK_PROJECT_PATH
Then running ndk-build again:
6) $ /cygdrive/c/Work/Downloads/Dev/android-ndk-r8b-windows/android-ndk-r8b/ndk-build
This time a slightly different error:
$ /cygdrive/c/Work/Downloads/Dev/android-ndk-r8b-windows/android-ndk-r8b/ndk-build
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /cygdrive/c/Work/Downloads/Dev/orxsvn/code/build/android-native/jni/Android.mk
/cygdrive/c/Work/Downloads/Dev/android-ndk-r8b-windows/android-ndk-r8b/build/core/add-application.mk:133: *** Android NDK: Aborting... . Stop.
So it seems the path is being accessed by ndk-build now, but within the Android.mk, it is missing something? The problem seems path related but I am not sure where I am going wrong.
Comments
Instead, orx will be compiled and linked directly with your project.
So you need to call ndk-build from <mylibs>/<orx>/code/demo/android-native.
It will complain it can't find orx, so you need first to execute:
export NDK_MODULE_PATH=<mylibs>
where mylibs is the directory which contain the orx folder.
hope it will help
Lyde
I see that your orx folder is orxsvn, so either your rename it to orx, or you can edit the file demo/android-native/jni/Android.mk, and change $(call import-module,orx/code/build/android-native) with $(call import-module,orxsvn/code/build/android-native)
Went back and renamed the orxsvn to orx, which fixed it and I got a stack of stuff compiling.
That'll teach me to go outside of the standard folder names
I've been working through the guide on the wiki at: http://orx-project.org/wiki/setup_android_manual
My confusion is around Step 4 where you take a copy of Android.mk and place it into your workspace project, then edit it as per instructions.
The recommended lines are:
These are to be placed into the beginning of Android.mk but it's not too clear how. The first few lines of Android.mk are:
I assume I should probably remove the existing orx lines and add these put the format and the names of the parameters are quite different and I'm really just hacking away.
I can see that the library lines need to point to valid libraries, and that's configured ok I believe. I actually copied the whole extern folder from SVN to jni for the sake of ease but also tried a relative path back to my svn installation.
After all this, it doesn't really matter what I do... ndk-build gives no output. I export the NDK_MODULE_PATH to my project path, and I am in the project as well, but no output when attempting to compile.
If I use the -d parameter... ndk_build -d gives a stack of output. Halfway down there's this:
So I dunno....
I feel I'm really close to get it right. Any help is always appreciated.
http://orx-project.org/wiki/setup_android_manual is completely deprecated...
(it should be delete)
the first thing is to try to compile and run the demo located in demo/android-native.
In a nutshell
1) export NDK_MODULE_PATH=...
2) ndk-build in demo/android-native directory
3) open eclipse
4) import the project
5) deploy on device (sometimes a clean in eclipse may fix things)
If you can run the demo, you should start from there.
The important file is jni/Android.mk use this as a template, if you are lost you can check ANDROID-MK.html from ndk docs.
also, your ressources files (.ini, .png, .ogg) must be located in the assets folder (like in the demo).
and the "main" ini file is orx.ini or orxd.ini, so just include your real main.ini from on of these files.
one more thing.
the name you call your module in Android.mk (LOCAL_MODULE) must match the "android.app.lib_name" in the AndroidManifest.xml (buts that's standard Android NativeActivity stuff)
hope it will help
Thank you for your help, Lyde.
I'll be expanding the docs for newbies like myself so that it is a little more verbose.
Also came across permissions issues with ndk under windows and I'll include those instructions too.
me too I'm trying to get the android version working.
I'm ok with building the demo and deploying but problems with the process of building a completely new application.
I'm using Ubuntu 12.04, Eclipse juno and the lastes android stuff.
1 - if i ndk-build the demo/android-native folder, onlt liborxd.a is generated while i want the release version too.
2 - i'd like to keep orx in a 'libraries' directory where i keep most of my libraries, and the code of projects in other folders. Should i modify the android.mk (call import-module, path)?
3 - In other projects i'm able to debug java and c++ code in the same time but with orx i find it really hard.
How do you debug your apps?
Thank you in advance.
PS: the demo, in emulator, stops working because of unimplemented Open GL function
09-07 08:59:47.465: E/libEGL(334): called unimplemented OpenGL ES API
09-07 08:59:47.465: E/libEGL(334): called unimplemented OpenGL ES API
09-07 08:59:47.465: E/libEGL(334): called unimplemented OpenGL ES API
09-07 08:59:47.465: D/ORX(334): [08:59:47] [ASSERT] [orxDisplay.c:orxDisplay_Android_Init():3405] [ASSERT] : <eError == GL_NO_ERROR && "OpenGL error code: 0x500">
Looks like you and I have reached the same spot. So far I can:
* Compile the demo
* Run the demo on a real device.
I cannot:
* Run the demo in the sdk emulators
* Run my own application in an sdk emulator
* Run my own application on a real device
I few things I have done to try and get some success (maybe this checklist will help you):
* Use a copy of the demo structure as a base
* Ensure that the paths to your assets (images, sound, fx, etc) are changed in the ini file to fit the new file location under the android project.
* Change the Android.mk to take in your own files. I'm try to add game.cpp extras.cpp. Not mentioning .h files because online examples I've seen don't either.
Everything compiles nicely but the thing won't run anywhere. I'll probably bring some details tomorrow but I still suspect that it has something to do with a file not find another. Maybe my ini. Who knows.
I haven't worked out how to get normal orx log output from eclipse to see what's happening or an error log off a real device.
Hope you have a better time of it.
I keep trying...but...
the main problem i have is that I can compile my code from other locations but i can't deploy and debug because when I press F11 in eclipse it prints 2 kinds of errors:
Unknown Application ABI
Unable to detect application ABI's
and it prompts that NDK_MODULE_PATH is not defined and it can't find any module in 'orx/code/build/android'.
When building in eclipse i had to specify the NDK_MODULE_PATH in Project->Properties->C/C++ Build and i set the command line to:
ndk-build NDK_DEBUG=1 NDK_MODULE_PATH=/my/path/to/orx/containing/folder
When running the debugger it says the NDK_MODULE_PATH is not set.
If I disable orx, nvevetn and i make my activity to derive from standard android activity, it works well and i can debug without problems.
As soon as I try to use orx and nvevent libraries errors come out.
Where should I specify the NDK_MODULE_PATH to let my application to compile from eclipse?
So now I can see that eclipse complains that orxMyGame (or liborxMyGame) is missing.
I think my process is different to yours, in that I specify NDK_MODULE_PATH in cygwin, then build, before moving to eclipse.
So...
I used ndk-build with cygwin, and it created the liborxMyGame.so file.
I imported the project into eclipse.
If I debug and send to a virtual device, I get the error about the missing library.
Maybe it's because eclipse needs paths to the lib folder to find the library. I don't know.
Once we get this down, we can do a concise document to spell it out.
It's your device which can't found the lib.
BTW: don't try on the emulator, it wont work.
you need to check that you have liborxMyGame.so in your libs folder.
if you have, try a clean project in eclipse and redeploy on your device.
I followed another way to develop.
Under Ubuntu 12.04 I use Eclipse Juno, SDK 20.0.3 with the proper ADT plugin and NDK r8b.
I start the project as a java project that loads my native library via JNI interface.
I build the project from eclipse using a specific command line like : ndk-build NDK_MODULE_PATH := /path/to/orx/containing/folder
It's the only way to make the project to build and don't use an environmental variable that's the same for all projects.
I tried to specify the variable inside the Android.mk or Application.mk files but the error about undefined NDK_MODULE_PATH comes out.
To me it seems that when launching the debugger it tries to compile the code another time but without using the same command line.
Dunno what to do....
What do you mean?
On other projects I can build and debug all native code using breakpoints and so on.
Ah ok. I'll stop trying to get this to happen, if an emulator is never going to run it.
In my last ditched attempt I:
* Duplicated the code/demo structure
* Replaced everything with my own assets & code
* Went through every android file in the struct renaming stuff from orxTest to my termyticus (my project name).
* ndk-build. Got obj folder with stuff. Got libsarmeabilibtermyticus.so & libsarmeabi-v7alibtermyticus.so
* Ran eclipse, imported project into workspace.
* Project Clean
* Project Build
* Debug & Cancel to build the APK
I unzipped a copy of my APK to have a peek. The structure is:
/assets/ (PNGs, OGGs & INIs)
/lib/armeabi/libtermyticus.so
/lib/armeabi-v7a/libtermyticus.so
/META-INF/ (a few items)
/res/ (drawable folders)
AndroidManifest.xml
class.dex
resources.arsc
Lo and behold, the darn thing worked! Well sort of. Got weird debug blocks filling the screen, but that's down to not setting up the viewport properly or something. Not important.
I have done this so many times, and the only thing I can think of that I have done differently is to take more care renaming project files before doing the ndk-build, then taking to eclipse.
Also eclipse appears to be a little flaky at times. Remove a project and then import a new one, the autogeneration of files does not always work. Gives errors. Close and reopen eclipse and it starts working again. Weird.
Who cares. This is working now, a major step for me.
So, ainvar... now to get yours working.
That is: you must use the filenames orx.ini and orxd.ini. Not your own project named ini's, eg: yourproject.ini and yourprojectd.ini.
This tidbit should remove at least one frustration if you are trying to work with android. I'll add this note to the documentation on the wiki soon.