[ OCC - ANDROID HOWTO ]

Dear Community,

if you want to run OpenCASCADE latest version on Android, you can do this now
by following a few simple steps (more or less).

You'll need to have the standard developer's tools on Linux.
(including Java Development Kit) please check!:
$ update-alternatives --config java (* 3 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode)
$ update-alternatives --config javac (* 3 /usr/lib/jvm/java-6-sun/bin/javac 63 manual mode)
$ update-alternatives --config javah (* 2 /usr/lib/jvm/java-6-sun/bin/javah 63 manual mode)

I recommend you to Download/Install to $HOME/OCCANDROID so you have everything at one place.

1. Download/Install Eclipse with C/C++ support - http://www.eclipse.org/downloads/

2. Download/Install Android(ADT) plugin for Eclipse
[http://developer.android.com/sdk/eclipse-adt.html]
(~/OCCANDROID/android-sdk-linux_x86$ ./tools/android) or use Eclipse plugin.
(SDK Platform Android 1.6, AP 4, Android SDK Platform-tools, revision 6)
(Old hardware support too)

3. Download/Install latest SDK(Software Development Kit)
[http://developer.android.com/sdk/index.html]

4. Download/Install latest NDK(Native Development Kit)
[http://developer.android.com/sdk/ndk/index.html]

5. Download/Install Apache Ant
[http://ant.apache.org] (apt-get install ant)

6. Download allready OCCT pre-compiled (binary) shared librarys for Android
from http://github.com/goranl - [Download] somewhere in the right corner

7. cd $HOME
8. mkdir -p $HOME/OCCANDROID/Examples
9. cd $HOME/OCCANDROID/Examples
10. git clone git://github.com/goranl/OCCANDROID.git
This will download two dir. Please remove dir "Example"- so that you have only "OCCANDRODID"
(I've created github user account today, and have no idea how to use it :-))

11. Create Environment variables
export OCCANDROID=$HOME/OCCANDROID
export PATH=$PATH:$HOME/OCCANDROID/android-ndk-r6b
export PATH=$PATH:$HOME/OCCANDROID/android-sdk-linux_x86/tools
export PATH=$PATH:$HOME/OCCANDROID/android-sdk-linux_x86/platform-tools
export ANDROID_SDK=$HOME/OCCANDROID/android-sdk-linux_x86
export ANDROID_NDK=$HOME/OCCANDROID/android-ndk-r6b
export ANDROID_ARM_4=$HOME/OCCANDROID/android-ndk-r6b/platforms/android-4/arch-arm/usr

12. cd $OCCANDROID
cd Examples/OCCMobileExample2

12.1
Connect your phone with your machine via USB and make sure "USB debugging"
and "Allow mock locations" is on.
adb devices
ant install

12.2
Create/Start emulator
android create avd -n myHTC -t android-4 -c 1000M -s QVGA
emulator -avd myHTC -skin QVGA

13. Enjoj:)

Best Regards,
Goran Lukic

Forum supervisor's picture

Dear Goran,
We appreciated your efforts and done work.
It is really impressive...
We would be pleased also to get performance details
and possible remarks/comments concerning OCCT behavior
(if possible of course).
Regards

Goran Lukic's picture

Hello Forum supervisor,

My intention was originally to use only a few components for my personal
use. I did not have time to do more tests. Only i can say is that those
things that are important to me - working *excellent*.

Goran

Cauchy Ding's picture

Genius!!!

heXus's picture

Great!!!

Roman Lygin's picture

Hi Goran,
Thanks for this post. Can you add some details about which components you have managed to run? In particular, were you able to get TKV3d running on top of OpenGL-ES ? Secondly, have you been able to run the app on any physical device in addition to emulator ? (Presumably not as you seemed to use x86-only NDK but just in case).

Thanks,
Roman

Goran Lukic's picture

Roman,

You can find everything inside tar.gz archive (is available at: http://github.com/goranl)
I run my app on device (real device *not* emulator) that has only poor support for OpenGL and it is crippled version of anything,
so i have not even tried to get TKV3d running on top of OpenGL ES 1.1 ;-)

Goran

heXus's picture

How you compile OCC with NDK? Is there some patches for OCC? And where I should get ".hxx" files? From original OCC sources?

P Dolbey's picture

Now I'm tempted to try a port to webOS for my HP TouchPad.

Pete

Goran Lukic's picture

heXus,

You can safely use your own header files. If you use something that doesn't exist
you won't be able to compile anyway - so don't worry;-)

Please have in mind that we deal with cross-compiling, and to make the pathes *real* corectly,
(not just for my own private use) it is a bit of work to do.
And BTW we are *lucky* because OpenCASCADE is *very well* designed for cross-compiling.

What kind of droid phone do you own? Were you able to get this basic examples running on your phone?
Or maybe it's not the phone at all..
Please, write some reports.

Thanks,
Goran

Fabiano Correa's picture

Dear Goran Luckic,
I'm trying to port some public libraries that uses OpenCASCADE to android tablets, and get to know the work you've done. You compile OpenCASCADE in Android for what platform? I can't run any application using your OpenCASCADE libraries above Android 2.3. I successfully run in android 1.6. Could you give me some help in this case? I need OpenCASCADE for Android 3.2 or above.

Best regards, Fabiano Correa

jelle's picture

Interesting work. Perhaps a git OCC or OCE branch would be helpful to coordinate the effort?

Fabiano Correa's picture

Apologies ... I understood the problem with my compilations. Using NetBeans or MSVisual Studio, sometimes the C code don't used the same android platform, and the application couldn't run. Now I successfully compiled and run in other android platforms, 1.6, 2.2, 2.3, 3.2, 4.0 ...

Goran Lukic's picture

Please find attached v651.patch and runAndroid.sh
Enjoy.

Attachments: 
Fabiano Correa's picture

Thanks for the help!

Goran Lukic's picture

Update to OCCT 6.5.4 version
Enjoy.

nickelastic's picture

Hi Goran,
Do you still have this OCCT 6.5.4 version (or any more recent) ? that last link was empty.

Many thanks

Tauqir Ansari's picture

After very thorough research and hard work I am able to built the libraries for android.

Download from here.