简体   繁体   English

不满意的链接错误Android Eclipse

[英]Unsatisfied Link Error Android Eclipse

I am attempting to create an android project that loads a native libary specifically openal using a compiled .so file which I used cygwin to compile, in my onCreate method i have the following code 我正在尝试创建一个Android项目,该项目使用我使用cygwin进行编译的.so文件加载专门加载本机库的本机openal文件,在我的onCreate方法中,我有以下代码

System.loadLibrary("openal.so");

and my compiled libaries are in my libs/armeabi folder 我编译的库文件在我的libs / armeabi文件夹中

my two native code files consist of a .c file containing 我的两个本机代码文件由一个.c文件组成,其中

#include "com_example_helloopenal_MainActivity.h"

JNIEXPORT jint JNICALL Java_com_example_helloopenal_MainActivity_play
(JNIEnv * env, jobject obj, jstring filename) {
return 0;
}

and a .h file containing 和一个.h文件,其中包含

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_example_helloopenal_MainActivity */

#ifndef _Included_com_example_helloopenal_MainActivity
#define _Included_com_example_helloopenal_MainActivity
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class:     com_example_helloopenal_MainActivity
* Method:    play
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_com_example_helloopenal_MainActivity_play
(JNIEnv *, jobject, jstring);

#ifdef __cplusplus
}
#endif
#endif

the method play called in the onCreate and written in the .c file should return 0 in log cat at this point but instead the application crashes with the following error message 此时在onCreate中调用并写入.c文件的方法play应该在log cat中返回0,但是应用程序崩溃并显示以下错误消息

01-20 16:11:51.299: E/AndroidRuntime(10842): java.lang.UnsatisfiedLinkError: Couldn't load openal.so from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.helloopenal-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.helloopenal-2, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null 01-20 16:11:51.299:E / AndroidRuntime(10842):java.lang.UnsatisfiedLinkError:无法从加载程序dalvik.system.PathClassLoader [DexPathList [[zip file“ / data / app / com。 example.helloopenal-2.apk“],nativeLibraryDirectories = [/ data / app-lib / com.example.helloopenal-2,/ vendor / lib,/ system / lib,/ system / lib / arm]]]:findLibrary返回空值

I am new to ndk development so any enlightment on the cause or nature of this issue would be appreciated 我是ndk开发的新手,因此对这个问题的原因或性质有任何启发

Update of full error log after corrective action in jorges reply 在jorges回复中采取纠正措施后更新完整的错误日志

01-20 17:01:06.299: E/memtrack(12000): Couldn't load memtrack module (No such file or directory)
01-20 17:01:06.299: E/android.os.Debug(12000): failed to load memtrack module: -2
01-20 17:01:07.479: E/ivpg-hwc(156): Lost 1 flips
01-20 17:01:07.479: E/ivpg-hwc(156): Lost 1 flips
01-20 17:01:07.939: E/NetworkScheduler.SchedulerReceiver(750): Invalid parameter app
01-20 17:01:07.939: E/NetworkScheduler.SchedulerReceiver(750): Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
01-20 17:01:08.069: E/AppsCustomizePagedView(900): Widget ComponentInfo{com.kobobooks.android/com.kobobooks.android.widget.StoreWidgetProvider} can not fit on this device (1062, 1200)
01-20 17:01:08.359: E/memtrack(12024): Couldn't load memtrack module (No such file or directory)
01-20 17:01:08.359: E/android.os.Debug(12024): failed to load memtrack module: -2
01-20 17:01:08.549: E/dalvikvm(12046): Houdini dlopen("/data/app-lib/com.example.helloopenal-2/libopenal.so") failed: Can't load ARM library
01-20 17:01:08.549: E/AndroidRuntime(12046): FATAL EXCEPTION: main
01-20 17:01:08.549: E/AndroidRuntime(12046): Process: com.example.helloopenal, PID: 12046
01-20 17:01:08.549: E/AndroidRuntime(12046): java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.example.helloopenal-2/libopenal.so" has unexpected e_machine: 40
01-20 17:01:08.549: E/AndroidRuntime(12046):    at java.lang.Runtime.loadLibrary(Runtime.java:364)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at java.lang.System.loadLibrary(System.java:526)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at com.example.helloopenal.MainActivity.onCreate(MainActivity.java:15)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.Activity.performCreate(Activity.java:5231)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2218)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.ActivityThread.access$900(ActivityThread.java:142)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.os.Handler.dispatchMessage(Handler.java:102)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.os.Looper.loop(Looper.java:149)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at android.app.ActivityThread.main(ActivityThread.java:5097)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at java.lang.reflect.Method.invokeNative(Native Method)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at java.lang.reflect.Method.invoke(Method.java:515)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
01-20 17:01:08.549: E/AndroidRuntime(12046):    at dalvik.system.NativeStart.main(Native Method)
01-20 17:01:08.939: E/NetworkScheduler.SchedulerReceiver(750): Invalid parameter app
01-20 17:01:08.939: E/NetworkScheduler.SchedulerReceiver(750): Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
01-20 17:01:10.899: E/ivpg-hwc(156): Lost 1 flips
01-20 17:01:10.899: E/ivpg-hwc(156): Lost 1 flips
01-20 17:01:18.449: E/WindowManager(523): Starting window AppWindowToken{2252f9c0 token=Token{2269a480 ActivityRecord{2203eab0 u0 com.example.helloopenal/.MainActivity t28}}} timed out
01-20 17:01:19.089: E/AppsCustomizePagedView(900): Widget ComponentInfo{com.kobobooks.android/com.kobobooks.android.widget.StoreWidgetProvider} can not fit on this device (1062, 1200)
01-20 17:01:19.919: E/ivpg-hwc(156): Lost 1 flips
01-20 17:01:19.919: E/ivpg-hwc(156): Lost 1 flips
01-20 17:01:46.559: E/ivpg-hwc(156): Lost 1 flips

You should call it as System.loadLibrary("openal"); 您应该将其称为System.loadLibrary("openal"); without so extension 没有这样的扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM