java.lang.UnsatisfiedLinkError: Couldn't loadXX from loader dalvik.system.

java.lang.UnsatisfiedLinkError: Couldn't load NDK_04 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.duicky-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.duicky-1, /vendor/lib, /system/lib]]]: findLibrary returned null

08-13 16:25:59.829 E/AndroidRuntime( 2098):     at java.lang.Runtime.loadLibrary(Runtime.java:358)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at java.lang.System.loadLibrary(System.java:526)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at com.duicky.MainActivity.<clinit>(MainActivity.java:52)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at java.lang.Class.newInstanceImpl(Native Method)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at java.lang.Class.newInstance(Class.java:1208)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.app.Instrumentation.newActivity(Instrumentation.java:1073)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2154)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2327)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.app.ActivityThread.access$800(ActivityThread.java:151)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1225)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.os.Handler.dispatchMessage(Handler.java:102)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.os.Looper.loop(Looper.java:136)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at android.app.ActivityThread.main(ActivityThread.java:5281)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at java.lang.reflect.Method.invokeNative(Native Method)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at java.lang.reflect.Method.invoke(Method.java:515)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:932)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:748)
08-13 16:25:59.829 E/AndroidRuntime( 2098):     at dalvik.system.NativeStart.main(Native Method)
08-13 16:25:59.839 W/ActivityManager(  551): skipCurrentReceiverLocked app=ProcessRecord{42086b40 2098:com.duicky/u0a43} app.curReceiver=null killbyAm=false
08-13 16:25:59.839 W/ActivityManager(  551): queue:foreground mPendingBroadcast null
08-13 16:25:59.839 W/ActivityManager(  551): queue:background mPendingBroadcast null
08-13 16:25:59.839 W/ActivityManager(  551):   Force finishing activity com.duicky/.MainActivity



出現這樣的錯誤,可能你生成的so 庫文件沒有push 進 系統,導致apk 找不到庫加載。

嘗試執行 : adb push out/target/product/ndp959/system/lib/libNDK_04.so /system/lib/

我的Android.mk文件

#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This makefile shows how to build a shared library and an activity that
# bundles the shared library and calls it using JNI.

TOP_LOCAL_PATH:= $(call my-dir)

# Build activity

LOCAL_PATH:= $(TOP_LOCAL_PATH)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := samples

LOCAL_SRC_FILES := $(call all-subdir-java-files)

LOCAL_PACKAGE_NAME := SimpleJNI

LOCAL_JNI_SHARED_LIBRARIES := libsimplejni

LOCAL_PROGUARD_ENABLED := disabled

LOCAL_SDK_VERSION := current

include $(BUILD_PACKAGE)

# ============================================================

# Also build all of the sub-targets under this one: the shared library.
include $(call all-makefiles-under,$(LOCAL_PATH))




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章