문제

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