Logcat output:
03-03 12:42:32.665:e/androidruntime (32432): FATAL exception:main
03-03 12:42:32.665:e/androidruntime (32432): Process:com.toro.passwordencode, pid:32432
03-03 12:42:32.665:e/androidruntime (32432): java.lang.UnsatisfiedLinkError:Couldn ' t load Libpassword from Loader Dalvik.system.pathclassloader[dexpathlist[[zip file "/data/app/com.toro.passwordencode-1.apk"], Nativelibrarydirectories=[/data/app-lib/com.toro.passwordencode-1,/vendor/lib,/system/lib]]: findLibrary Returned null
03-03 12:42:32.665:e/androidruntime (32432): at Java.lang.Runtime.loadLibrary (runtime.java:358)
03-03 12:42:32.665:e/androidruntime (32432): at Java.lang.System.loadLibrary (system.java:526)
03-03 12:42:32.665:e/androidruntime (32432): at Com.toro.passwordencode.mainactivity.<clinit> ( MAINACTIVITY.JAVA:15)
03-03 12:42:32.665:e/androidruntime (32432): at Java.lang.Class.newInstanceImpl (Native Method)
03-03 12:42:32.665:e/androidruntime (32432): at Java.lang.Class.newInstance (class.java:1208)
03-03 12:42:32.665:e/androidruntime (32432): at Android.app.Instrumentation.newActivity (instrumentation.java:1061)
03-03 12:42:32.665:e/androidruntime (32432): at Android.app.ActivityThread.performLaunchActivity ( activitythread.java:2116)
03-03 12:42:32.665:e/androidruntime (32432): at Android.app.ActivityThread.handleLaunchActivity ( activitythread.java:2258)
03-03 12:42:32.665:e/androidruntime (32432): at android.app.activitythread.access$800 (ActivityThread.java:147)
03-03 12:42:32.665:e/androidruntime (32432): at Android.app.activitythread$h.handlemessage (ActivityThread.java : 1211)
03-03 12:42:32.665:e/androidruntime (32432): at Android.os.Handler.dispatchMessage (handler.java:102)
03-03 12:42:32.665:e/androidruntime (32432): at Android.os.Looper.loop (looper.java:136)
03-03 12:42:32.665:e/androidruntime (32432): at Android.app.ActivityThread.main (activitythread.java:5135)
03-03 12:42:32.665:e/androidruntime (32432): at Java.lang.reflect.Method.invokeNative (Native Method)
03-03 12:42:32.665:e/androidruntime (32432): at Java.lang.reflect.Method.invoke (method.java:515)
03-03 12:42:32.665:e/androidruntime (32432): at Com.android.internal.os.zygoteinit$methodandargscaller.run ( zygoteinit.java:795)
03-03 12:42:32.665:e/androidruntime (32432): at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:611)
03-03 12:42:32.665:e/androidruntime (32432): at Dalvik.system.NativeStart.main (Native Method)
The ANDROID.MK code is as follows:
local_path : = $ (call my- dir) include $ (Clear_vars) #LOCAL_MODULE: = Libencodepassword #导致错误的行, where the so class library name cannot begin with "Lib". The so class library file that should be generated at compile time has a conflict with the Lib prefix. Here is a question mark, solving local_module : = Encodepassword #正确行 # local_src_files : = Password.cinclude $ (build_shared_library)
The Mainactivity.java code is as follows:
// load CPU architecture corresponds to so class library Static { // //The line that caused the error, where the so class library name cannot begin with "Lib" system.loadlibrary ( "Encodepassword" // correct }
Couldn ' t load Libpassword One of the reasons that the class library was not found when compiling the C file into the CPU's so class library from LOADER:NDK development