开发者

Android C++ Native Code

开发者 https://www.devze.com 2023-02-07 14:18 出处:网络
I am a new Android developer and I would like to create an application using only C/C++ code for Android but I have foun开发者_运维百科d the documentation to be very limited. I can create an Android C

I am a new Android developer and I would like to create an application using only C/C++ code for Android but I have foun开发者_运维百科d 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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消