我想在下面的方式,從我的項目的MainActivity加載預生成本地共享庫:的Android java.lang.exceptionininitializererror的System.loadLibrary
static
{
System.loadLibrary("mylib.so"); // I have tried this way
//System.loadLibrary("libmylib.so"); // Also tried this way
//System.loadLibrary("mylib"); // Also tried this way
}
但任何時候它拋出以下異常:
警告前例外:
07-12 11:08:36.019: W/dalvikvm(21552): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/libtest/src/MainActivity;
07-12 11:08:42.790: W/dalvikvm(21552): Class init failed in newInstance call (Lcom/libtest/src/MainActivity;)
07-12 11:08:47.067: D/AndroidRuntime(21552): Shutting down VM
07-12 11:08:47.067: W/dalvikvm(21552): threadid=1: thread exiting with uncaught exception (group=0x40015560)
然後例外:
07-12 11:08:47.167: E/AndroidRuntime(21552): FATAL EXCEPTION: main
07-12 11:08:47.167: E/AndroidRuntime(21552): java.lang.ExceptionInInitializerError
07-12 11:08:47.167: E/AndroidRuntime(21552): at java.lang.Class.newInstanceImpl(Native Method)
07-12 11:08:47.167: E/AndroidRuntime(21552): at java.lang.Class.newInstance(Class.java:1409)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.os.Handler.dispatchMessage(Handler.java:99)
07-12 11:08:47.167: E/AndroidRuntime(21552): at android.os.Looper.loop(Looper.java:130)
本地共享庫在我的項目文件夾下放置了「libs \ armeabi \ mylib.so」。
請幫助我做錯了什麼?
你使用的是cocos2dx嗎? – KOTIOS
不,我不使用cocos2dx。 – Parveen