2013年9月18日星期三

[Android] Run time using ndk library not found

 This post last edited by the jxcyly1985 on 2011-04-13 13:58:55
I according to the method of preparation of a good online eclipse then so files are also generated
I am running the NDK hello-jni example
packaged open that apk file and there was so packed into the libhello-jni.so
I also modified the code changed
static {
System.loadLibrary ("libhello-jni.so");
} to "hello-jni.lib" added the "lib"

But using the simulator crashes when running the example used is the 2.2 SDK
who encountered this problem ah ? help thank you
I was in windows7 platform under development .

error log
04-13 02:41:43.662: ERROR / Zygote (33): setreuid () failed. errno: 2
04-13 02:41:51.282: ERROR / Zygote (33): setreuid () failed. errno: 17
04-13 02:41:52.522: ERROR / BatteryService (59): usbOnlinePath not found
04-13 02:41:52.522: ERROR / BatteryService (59): batteryVoltagePath not found
04-13 02:41:52.522: ERROR / BatteryService (59): batteryTemperaturePath not found
04-13 02:41:52.542: ERROR / SurfaceFlinger (59): Couldn't open / sys / power / wait_for_fb_sleep or / sys / power / wait_for_fb_wake
04-13 02:41:59.422: ERROR / EventHub (59): could not get driver version for / dev/input/mouse0, Not a typewriter
04-13 02:41:59.422: ERROR / EventHub (59): could not get driver version for / dev / input / mice, Not a typewriter
04-13 02:41:59.692: ERROR / System (59): Failure starting core service
04-13 02:41:59.692: ERROR / System (59): java.lang.SecurityException
04-13 02:41:59.692: ERROR / System (59): at android.os.BinderProxy.transact (Native Method)
04-13 02:41:59.692: ERROR / System (59): at android.os.ServiceManagerProxy.addService (ServiceManagerNative.java: 146)
04-13 02:41:59.692: ERROR / System (59): at android.os.ServiceManager.addService (ServiceManager.java: 72)
04-13 02:41:59.692: ERROR / System (59): at com.android.server.ServerThread.run (SystemServer.java: 184 )
04-13 02:42:00.562: ERROR / SoundPool (59): error loading / system / media / audio / ui / Effect_Tick.ogg
04-13 02:42:00.572: ERROR / SoundPool (59): error loading / system / media / audio / ui / KeypressStandard.ogg
04-13 02:42:00.572: ERROR / SoundPool (59): error loading / system / media / audio / ui / KeypressSpacebar.ogg
04-13 02:42:00.572: ERROR / SoundPool (59): error loading / system / media / audio / ui / KeypressDelete.ogg
04-13 02:42:00.572: ERROR / SoundPool (59): error loading / system / media / audio / ui / KeypressReturn.ogg
04-13 02:42:03.413: ERROR / ThrottleService (59): Could not open GPS configuration file / etc / gps.conf
04-13 02:42:04.922: ERROR / logwrapper (144): executing / system / bin / tc failed: No such file or directory
04-13 02:42:05.022: ERROR / logwrapper (145): executing / system / bin / tc failed: No such file or directory
04-13 02:42:05.042: ERROR / logwrapper (146): executing / system / bin / tc failed: No such file or directory
04-13 02:42:20.249: ERROR / HierarchicalStateMachine (59): TetherMaster - unhandledMessage: msg.what = 3
04-13 03:23:34.869: ERROR / AndroidRuntime (276): FATAL EXCEPTION: main
04-13 03:23:34.869: ERROR / AndroidRuntime (276): java.lang.ExceptionInInitializerError
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at java.lang.Class.newInstanceImpl (Native Method)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at java.lang.Class.newInstance (Class.java: 1429)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.app.Instrumentation.newActivity (Instrumentation.java: 1021)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2577)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java: 2679)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.app.ActivityThread.access $ 2300 (ActivityThread.java: 125)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 2033 )
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.os.Handler.dispatchMessage (Handler.java: 99)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.os.Looper.loop (Looper.java: 123)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at android.app.ActivityThread.main (ActivityThread.java: 4627)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at java.lang.reflect.Method.invokeNative (Native Method)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at java.lang.reflect.Method.invoke (Method.java: 521 )
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit . java: 868)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java : 626 )
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at dalvik.system.NativeStart.main (Native Method)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): Caused by: java.lang.UnsatisfiedLinkError: Library libhello-jni not found
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at java.lang.Runtime.loadLibrary (Runtime.java: 461)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at java.lang.System.loadLibrary (System.java: 557)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): at com.example.hellojni.HelloJni. (HelloJni. java: 64)
04-13 03:23:34.869: ERROR / AndroidRuntime (276): ... 15 more
04-13 04:55:16.259: ERROR / AndroidRuntime (306): FATAL EXCEPTION: main
04-13 04:55:16.259: ERROR / AndroidRuntime (306): java.lang.ExceptionInInitializerError
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at java.lang.Class.newInstanceImpl (Native Method)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at java.lang.Class.newInstance (Class.java: 1429)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.app.Instrumentation.newActivity (Instrumentation.java: 1021)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2577)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java: 2679)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.app.ActivityThread.access $ 2300 (ActivityThread.java: 125)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 2033 )
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.os.Handler.dispatchMessage (Handler.java: 99)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.os.Looper.loop (Looper.java: 123)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at android.app.ActivityThread.main (ActivityThread.java: 4627)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at java.lang.reflect.Method.invokeNative (Native Method)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at java.lang.reflect.Method.invoke (Method.java: 521 )
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit . java: 868)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java : 626 )
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at dalvik.system.NativeStart.main (Native Method)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): Caused by: java.lang.UnsatisfiedLinkError: Library. / lib / armeabi / libhello-jni ; not found
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at java.lang.Runtime.loadLibrary (Runtime.java: 461)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at java.lang.System.loadLibrary (System.java: 557)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): at com.example.hellojni.HelloJni. (HelloJni. java: 64)
04-13 04:55:16.259: ERROR / AndroidRuntime (306): ... 15 more
04-13 04:57:39.959: ERROR / AndroidRuntime (338): FATAL EXCEPTION: main
04-13 04:57:39.959: ERROR / AndroidRuntime (338): java.lang.ExceptionInInitializerError
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at java.lang.Class.newInstanceImpl (Native Method)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at java.lang.Class.newInstance (Class.java: 1429)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.app.Instrumentation.newActivity (Instrumentation.java: 1021)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2577)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java: 2679)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.app.ActivityThread.access $ 2300 (ActivityThread.java: 125)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 2033 )
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.os.Handler.dispatchMessage (Handler.java: 99)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.os.Looper.loop (Looper.java: 123)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at android.app.ActivityThread.main (ActivityThread.java: 4627)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at java.lang.reflect.Method.invokeNative (Native Method)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at java.lang.reflect.Method.invoke (Method.java: 521 )
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit . java: 868)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java : 626 )
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at dalvik.system.NativeStart.main (Native Method)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): Caused by: java.lang.UnsatisfiedLinkError: Library. / lib / armeabi / libhello-jni . so not found
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at java.lang.Runtime.loadLibrary (Runtime.java: 461)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at java.lang.System.loadLibrary (System.java: 557)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): at com.example.hellojni.HelloJni. (HelloJni. java: 64)
04-13 04:57:39.959: ERROR / AndroidRuntime (338): ... 15 more

------ Solution ------------------------------------ --------
System.loadLibrary ("libhello-jni.so");
parameter does
------ Solution ---------------------------------- ----------
configuration file correct?

------ Solution ------------------------------------ --------
I doubt so you SYSTEM.loadlib name and does not correspond to
------ Solution ---------------- ----------------------------
today, I have encountered this kind of problem , basically determine your . so there are problems, I is modified . mk file was compiled correctly . Please check your landlord mk file it
------ Solution -------------------------------- ------------
try to understand LIB several load / incidental way, right
------ Solution ------------- -------------------------------
System.loadLibrary ("libhello-jni.so");

should be modified to

System.loadLibrary ("hello-jni");
------ eference ---------------------- -----------------

I used System.loadLibrary ("hello-jni")
System.loadLibrary ("libhello-jni")
will not
------ eference ---------------------------------- -----
Android.mk and Mainfest.Xml hair look
------ eference --------------------- ------------------
I also encountered the same problem, the problem is in . mk file , change the library name will be solved , speechless !
------ eference -------------------------------------- -
my cause of the problem is the inclusion of illegal characters ( was previously entered on the window ) , all the re-enter again, resolved. ubuntu 10.04
------ eference ------------------------------------- -

landlord I have encountered a problem like you . Tried many times , online will not work. I do not know how to solve. On the phone and be able to run , I saw downloads / data / data / xx.xxx / lib / below calls . So library file. Just do not know why the emulator does not work . Help. .
------ eference --------------------------------------- < br> 5 Floor positive Solutions
------ eference ----------------------------------- ----
add libs folder and then in this folder under the new armeabi folder then . so files are copied to the file directory.
------ eference --------------------------------------- < br> apk generate not, then look at the generated libs / armeabi the so file name, the program is that you do not have to generate problems, generate successful System.loadLibrary ("your_lib_name"), you_lib_name for the library name is not with lib prefix and . so suffix
------ eference --------------------------------- ------
Why not on the phone on the simulator can ah ?
------ eference --------------------------------------- < br> 14 F positive Solutions ah , help me solve the problem , thank you
------ eference - --------------------------------------
in libs \ armeabi folder to add . so files ( I was libjpush.so), add the following code in the class block :
static {
System.loadLibrary ("jpush");
}

没有评论:

发表评论