Couldn't load libPassword from loader: When the C file in NDK development is compiled into the so class library of the cpu, one of the reasons why the class library error cannot be found is libpasswordndk.
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. initialize mlaunchactivity (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 # The row that causes the error. Here, the so library name cannot start with "lib. The so class library files generated during compilation all conflict with the lib prefix. Enter a question mark here to solve LOCAL_MODULE: = EncodePassword # correct line # LOCAL_SRC_FILES: = Password. cinclude $ (BUILD_SHARED_LIBRARY)
The MainActivity. java code is as follows:
// Load the so class library static {// System. loadLibrary ("libEncodePassword"); // The row that causes the error. Here, the so library name cannot start with "lib. loadLibrary ("EncodePassword"); // correct}