我下载了NDK,里面sapmles目录下有个“native-activity”的demo,请问这个demo编译后如何安装到android手机上,“hello-jni”这个demo我安装运行是可以的,但它是通过Java代码调用的,我想问下能否不通过JNI,直接将纯C++应用部署的手机上运行,求步骤,先说声谢谢!
另外,“native-activity”这个demo的代码中有个名为void android_main(struct android_app* state) 的函数,注释说,这个是程序入口,请问这个是不是android上的main函数,程序要怎么编译或配置后才能调用这个入口:
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main(struct android_app* state) {
另外,“native-activity”这个demo的代码中有个名为void android_main(struct android_app* state) 的函数,注释说,这个是程序入口,请问这个是不是android上的main函数,程序要怎么编译或配置后才能调用这个入口:
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main(struct android_app* state) {
是在AndroiodManifest.xml来制定native activity的
--------------------------The NDK is *not* a good way to write generic native code that runs on Android
devices. In particular, your applications should still be written in the Java
programming language, handle Android system events appropriately to avoid the
"Application Not Responding" dialog or deal with the Android application
life-cycle.NDK不是写运行在Android设备上的通用native代码的好方法.特别是您的程序应该仍用Java语言来写,处理安卓系统事件来避免ANR错误或者处理Android应用生命周期
native code with a small "application wrapper" used to start/stop it
appropriately.
注意,但你可以用native代码写一个带有"应用外壳"复杂的程序,这个外壳用以恰当的开始/停止应用
docs目录下的NATIVE-ACTIVITY.HTML貌似说明了如何开发和部署纯C++应用,我再研究下