I have created a JNI file in AOSP at framework\base\core\java\com\mydomain\mypackage\MyClass.java

which internally call the c files of framework\base\core\jni\mydomain\my_clas.cpp

But after compilation MyClass is not avilable through the custom SDK.

Please anybody help me to include custom JNI code in to Android SDK.

有帮助吗?

解决方案

Add my_clas.cpp file to frameworks/base/core/jni/Android.mk

LOCAL_SRC_FILES:= \
       mydomain_mypackage_my_clas.cpp

This adds your .cpp file to platform.

For adding your MyClass.java file to Android SDK update Android API file (where are described all classes, which are included in SDK. Location of that file frameworks/base/api/current.txt):

make update-api

Then compile your SDK for Linux platform (for example):

make PRODUCT-sdk-sdk

Your Android SDK with custom class (MyClass.java) will be located at out/host/linux-x86/ in zip archive.

Use compiled custom Android SDK in your favorite IDE and easily call MyClass.java

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top