jack
jack

Reputation: 576

Android C++ Native Code

I am a new Android developer and I would like to create an application using only C/C++ code for Android but I have found the documentation to be very limited. I can create an Android C/C++ project in eclipse, but it uses a lot of java code.

I'm using NativeActivity (new to 2.3) and I need help setting up my project. Does anyone know how to do this?

http://developer.android.com/reference/android/app/NativeActivity.html

Upvotes: 5

Views: 6085

Answers (2)

gbjbaanb
gbjbaanb

Reputation: 52679

Yuo can look into the Lighthouse project for android, which allows you to use Qt (and therefore C++) code instead of java. You still need 1 line of java code to kick off your Qt app.

Upvotes: 0

Jason LeBrun
Jason LeBrun

Reputation: 13293

Just remove all of the generated Java code. You don't need it if you want a purely native activity. The only thing you need to do is to set up the Android Manifest file as shown in the documentation. In particular, you'll need:

        <!-- Tell NativeActivity the name of or .so -->
        <meta-data android:name="android.app.lib_name"
                android:value="native-activity" />

And you'll need to modify jni/Android.mk so that it builds a jni with the name lib_name.

Upvotes: 3

Related Questions