我有c和c + +中的現有代碼。我在Android.mk文件中添加了這些c文件和cpp文件。我已經在我的應用程序中成功創建了名爲itv.so的.so文件。但現在當我試圖運行Android應用程序是顯示錯誤一樣...java.lang.ExceptionInInitializerError導致:java.lang.UnsatisfiedLinkError:庫未找到
12-20 13:26:31.362: E/AndroidRuntime(716): FATAL EXCEPTION: main
12-20 13:26:31.362: E/AndroidRuntime(716): java.lang.ExceptionInInitializerError
12-20 13:26:31.362: E/AndroidRuntime(716): at com.example.Internet_TV12.onCreate(Internet_TV12.java:38)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.os.Looper.loop(Looper.java:123)
12-20 13:26:31.362: E/AndroidRuntime(716): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-20 13:26:31.362: E/AndroidRuntime(716): at java.lang.reflect.Method.invokeNative(Native Method)
12-20 13:26:31.362: E/AndroidRuntime(716): at java.lang.reflect.Method.invoke(Method.java:521)
12-20 13:26:31.362: E/AndroidRuntime(716): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-20 13:26:31.362: E/AndroidRuntime(716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-20 13:26:31.362: E/AndroidRuntime(716): at dalvik.system.NativeStart.main(Native Method)
12-20 13:26:31.362: E/AndroidRuntime(716): Caused by: java.lang.UnsatisfiedLinkError: Library itv not found
12-20 13:26:31.362: E/AndroidRuntime(716): at java.lang.Runtime.loadLibrary(Runtime.java:461)
12-20 13:26:31.362: E/AndroidRuntime(716): at java.lang.System.loadLibrary(System.java:557)
12-20 13:26:31.362: E/AndroidRuntime(716): at com.example.Display.<clinit>(Display.java:69)
12-20 13:26:31.362: E/AndroidRuntime(716): ... 14 more
我不知道爲什麼這個錯誤即將到來。我已經看到lib文件夾裏有libitv.so文件。 我也試過
static {
try {
System.loadLibrary("itv");
// System.load("/data/data/com/example/lib/itv.so");
}
catch (UnsatisfiedLinkError use) {
Log.e("JNI", "WARNING: Could not load itv.so");
}
}
但是得到同樣的錯誤。 任何人都可以告訴我這個錯誤的解決方案。 先謝謝您。
檢查這個職位http://stackoverflow.com/a/5367617/760489 – Pratik 2011-12-21 06:39:41