Android Binder构建错误 - 错误:未定义引用'android :: defaultServiceManager()

时间:2011-10-17 11:21:12

标签: android-ndk linker-errors

需要您的支持来解决我的问题,以使用binder构建示例“HelloWorldService”程序。

使用make构建时,我遇到了以下错误。

target Executable: helloworldclient (out/target/product/pandaboard/obj/EXECUTABLES/helloworldclient_intermediates/LINKED/helloworldclient)
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/pandaboard/obj/lib/libhelloworldservice.so: error: undefined reference to 'android::BBinder::BBinder()'
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/pandaboard/obj/lib/libhelloworldservice.so: error: undefined reference to 'android::Parcel::enforceInterface(android::String16 const&, android::IPCThreadState*) const'
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/pandaboard/obj/lib/libhelloworldservice.so: error: undefined reference to 'android::Parcel::readCString() const'
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/pandaboard/obj/lib/libhelloworldservice.so: error: undefined reference to 'android::Parcel::writeCString(char const*)'
prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/pandaboard/obj/EXECUTABLES/helloworldclient_intermediates/main_helloworldclient.o: in function main:packages/apps/HelloWorldService/helloworldclient/main_helloworldclient.cpp:24: error: undefined reference to 'android::defaultServiceManager()'
collect2: ld returned 1 exit status
make: *** [out/target/product/pandaboard/obj/EXECUTABLES/helloworldclient_intermediates/LINKED/helloworldclient] Error 1

请帮我解决此问题,如果需要详细信息,请与我们联系。

1 个答案:

答案 0 :(得分:1)

我找到了修复构建错误。

在我的Android.mk文件中添加了共享的binder lib条目

LOCAL_SHARED_LIBRARIES + = libbinder

能够毫无错误地构建。