簡體   English   中英

如何編譯android ndk binder源代碼

[英]How to compile android ndk binder source code

我想編譯使用c ++編譯的綁定器本機代碼我已經下載了4.04版本的本機源代碼。

當我嘗試構建這個庫時,它會給我以下錯誤:

    Android NDK: WARNING: APP_PLATFORM android-15 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
   [armeabi] SharedLibrary  : libzzz.so
    D:/android-ndk-r9c-windows-x86/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/zzz/Binder.o: in function android::Vector<android::String16>::do_copy(void*, void const*, unsigned int) const:jni/utils/TypeHelpers.h:142: error: undefined reference to 'android::String16::String16(android::String16 const&)'
    D:/android-ndk-r9c-windows-x86/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/zzz/Binder.o: in function android::Vector<android::String16>::do_splat(void*, void const*, unsigned int) const:jni/utils/TypeHelpers.h:154: error: undefined reference to 'android::String16::String16(android::String16 const&)'
    D:/android-ndk-r9c-windows-x86/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/zzz/Binder.o: in function android::Vector<android::String16>::do_destroy(void*, unsigned int) const:jni/utils/TypeHelpers.h:132: error: undefined reference to 'android::String16::~String16()'

Android.mk

sources := \
Binder.cpp \
BpBinder.cpp \
CursorWindow.cpp \
IInterface.cpp \
IMemory.cpp \
IPCThreadState.cpp \
IPermissionController.cpp \
IServiceManager.cpp \
MemoryDealer.cpp \
MemoryBase.cpp \
MemoryHeapBase.cpp \
MemoryHeapPmem.cpp \
Parcel.cpp \
PermissionCache.cpp \
ProcessState.cpp \
Static.cpp

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_LDLIBS += -lpthread
LOCAL_MODULE := libbinder1
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
LOCAL_SRC_FILES := $(sources)
include $(BUILD_SHARED_LIBRARY)

我經常搜索但是找不到任何幫助。 任何幫助將非常感激

從jni中刪除以前生成的“obj”文件,然后添加android.mk文件,如下所示

  LOCAL_PATH := $(call my-dir)

  include $(CLEAR_VARS)
  LOCAL_MODULE    := "your shared library name"// while compile it will be generated as [.so]
 LOCAL_SRC_FILES := \
 Binder.cpp \
 BpBinder.cpp \
 CursorWindow.cpp \
 IInterface.cpp \
 IMemory.cpp \
 IPCThreadState.cpp \
 IPermissionController.cpp \
 IServiceManager.cpp \
 MemoryDealer.cpp \
 MemoryBase.cpp \
 MemoryHeapBase.cpp \
 MemoryHeapPmem.cpp \
 Parcel.cpp \
 PermissionCache.cpp \
 ProcessState.cpp \
 Static.cpp


include $(BUILD_SHARED_LIBRARY)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM