Android的负载机库机库、负载、Android

2023-09-04 12:21:35 作者:装逼遭雷劈从头劈到逼

我试图加载一个图书馆中,我建有独立的NDK工具链。

我建libGLmove.so并把它放在库/我的Eclipse项目的armeabi

不过,在调用的System.loadLibrary(GLmove)抛出的UnsatisfiedLinkError

任何想法,如何解决问题,或让Android找到我的图书馆? 如何NDK-build程序包它建立后?库

编辑:确切的编译标志是:

  

/Users/thomas/Documents/android-ndk-r5b/toolchains/arm-eabi-4.4.0/$p$pbuilt/darwin-x86/bin/arm-eabi-g++ --sysroot = /用户/托马斯/文档/ Android的NDK-R5B /平台/ Android为8 /弓臂-march =的ARMv7-A -mfloat-ABI = softfp -mfpu =霓虹灯轮候册, - 修复皮层-A8 -fno-异常-fno-RTTI -nostdlib -fpic -shared -o GLmove.so -O3

解决方案

你有没有在生成的.apk文件检查(使用压缩工具来看待/它解压缩),看看你的库,可以通过包装?我有点怀疑它可能不是,因为我发现一切都被内置到库文件夹中的项目,并在我的构建机器会进入一个名为LIB的文件夹(无'S')中的APK

我也不会太惊讶,如果事实证明,Eclipse构建过程中不打包任何库它不知道。这是当然,不像与资源,这一下就凭借着在正确的地方被包装情况。

如果你发现你的库是不是在你的APK文件,我不认为你可以手动把它放在那里,因为它不会在包清单中显示出来,并会破坏任何签名也是如此。

你不提你的Eclipse项目是否是一个NDK项目(右键单击项目,Android的工具 - >添加原生支持)。如果没有,我怀疑你需要将它做成一个,然后您的库添加到Android.mk文件作为依赖而不是目标。

或:你可以尝试把你的库到/ RES项目和使用System.load()代替的System.loadLibrary()来加载它。我得承认,我从来没有尝试过自己,寿。

不可思议的飞机破解版下载 不可思议的飞机无限负载版下载v1.4.1 安卓版 2265游戏网

I'm trying to load a library I built with the standalone NDK toolchain.

I built libGLmove.so and placed it in libs/armeabi of my Eclipse project

However, the call to System.loadLibrary("GLmove") throws an UnsatisfiedLinkError

Any ideas as to how to resolve the problem or make Android find my library? How does ndk-build package the library after it builds it?

Edit: The exact compile flags are:

/Users/thomas/Documents/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/darwin-x86/bin/arm-eabi-g++ --sysroot=/Users/thomas/Documents/android-ndk-r5b/platforms/android-8/arch-arm -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8 -fno-exceptions -fno-rtti -nostdlib -fpic -shared -o GLmove.so -O3

解决方案

Have you checked in the resulting .APK file (use a zip utility to look at/unarchive it) to see if your library makes it through packaging? I'm a little suspicious that it might not, because I notice that everything that gets built into the "libs" folder in the project and on my build machine goes into a folder called "lib" (no 's') in the APK.

I wouldn't be too surprised if it turned out that the Eclipse build process doesn't package up any libraries it doesn't know about. This is, of course, unlike what happens with resources, which just get packaged by virtue of being in the right place.

If you find your library is not in your APK file, I don't think you can just manually put it in there, since it won't show up in the package manifest and will break any signing as well.

You don't mention whether or not your Eclipse project is an NDK project (right click on the project, Android Tools->Add Native Support.) If not, I suspect you'll need to make it into one and then add your library to the Android.mk file as a dependency and not a target.

Or: you could try putting your library into /res in the project and use System.load() instead of System.loadLibrary() to load it. I'll admit that I've never tried that myself, tho.