Android - build project

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
andrew_vorobey
Gnoblar
Posts: 5
Joined: Sat Aug 20, 2016 3:21 pm

Android - build project

Postby andrew_vorobey » Sat Aug 20, 2016 3:45 pm

Hello!
I've build the ogre with: http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide&tikiversion=Android. A get the apk file from the build and it was successfully running on android.
I'm following the tutorial and successfully building tutorial project on my ubuntu.
Now I want to build it(project) for android, but I don't know how cat I do this.

I've tried to make project on Android studio, added project sources as jni sources, added ogre build libs as jnilibs, get android.mk file and application.mk file from the ogre build folder.
But for now build is not successful: At start, android doesn't know where ogre headers is. As fast work around I've added full path to include files. For now error in OgreStdHeaders.h - it want to include vector, map and ect, but android studio doesn't know what is it.
I tried ndk r10b and r12b, I tried

Code: Select all

APP_STL := gnustl_static
in application.mk, but it all useless.

So, the question is "how can I build my app for android?".
The ideal variant is: build project to .so or .o file without android studio, and create .cpp jni file to call ogre project functions from android project.
I know how to make jni layer, but i don't know how to build ogre project to android compatible lib.
0 x

frostbyte
Orc Shaman
Posts: 715
Joined: Fri May 31, 2013 2:28 am

Re: Android - build project

Postby frostbyte » Sat Aug 20, 2016 6:59 pm

dont remember the details( did it 6 month ago ) but just tweaking sampleBrowser android build scripts to my project paths did the trick for me...
0 x
the government took my kudos, now i'm kudosless :?

farrer
Halfling
Posts: 56
Joined: Mon Sep 12, 2011 7:35 pm

Re: Android - build project

Postby farrer » Sun Aug 21, 2016 11:12 am

Or you could compile the JNI sample (adding

Code: Select all

-DOGRE_BUILD_ANDROID_JNI_SAMPLE=true
when configuring Ogre build) and adapt its code (it just starts Ogre and changes the viewport color to red) and build environment to your projects.
0 x

frostbyte
Orc Shaman
Posts: 715
Joined: Fri May 31, 2013 2:28 am

Re: Android - build project

Postby frostbyte » Sun Aug 21, 2016 6:53 pm

farrer is right- now i remember how i did it( thanks farrer... )
like farrer suggested i used the ANDROID_JNI_SAMPLE( much simpler code then sampleBrowser ) and tweaked it to start my project, however...
ANDROID_JNI_SAMPLE does'nt have RTShader build-in, so all meshes are renderered without materials.
so i borrowed the RTShader declaration and initialazation from SampleBrowser( remember it was'nt that easy... )
since then HLMS-PBS became available for ogre1.10, so now you can use it instead of RTShader if you preffer PBS( there is a hlms sample )
this was quite a trip( took me a while to find out why all is black ) - i never thought seing OgreHead being rendered can give me so much joy (-:

i can also recommend you to use "Andy"- simply the best android-arm-VM out there, just don't use googles emulator...
0 x
the government took my kudos, now i'm kudosless :?

andrew_vorobey
Gnoblar
Posts: 5
Joined: Sat Aug 20, 2016 3:21 pm

Re: Android - build project

Postby andrew_vorobey » Sun Aug 21, 2016 9:35 pm

Thanks a lot!
This flag is exactly what I want.

Code: Select all

-DOGRE_BUILD_ANDROID_JNI_SAMPLE=true
0 x


Return to “Mobile Devices”

Who is online

Users browsing this forum: No registered users and 2 guests