gpt4 book ai didi

Android SDK 应用加载库失败

转载 作者:太空宇宙 更新时间:2023-11-03 10:49:53 26 4
gpt4 key购买 nike

嘿嘿。我收到了与这个人相同的错误消息:“Android NDK app failed to load library”几个小时以来,我一直在尝试根据我的情况将这些答案转移到这里,但它不起作用。有人能帮我吗?这是这里的开源项目,我想尝试让它在我的模拟器上运行。 https://github.com/itskewpie/FreeRDP-android

FreeRDPActivity.java

package net.itskewpie.freerdp;

import android.app.Activity;
import android.os.Bundle;

public class FreeRDPActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
static {
System.loadLibrary("freerdp");
}
}

freerdp.c

#include <jni.h>
#include <stdio.h>
#include <freerdp/freerdp.h>

jstring Java_net_itskewpie_freerdp_FreeRDPActivity_test(JNIEnv* env, jobject thiz )
{
android_main();
return (*env)->NewStringUTF(env, "HELLO");
}

安卓.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

MY_LIBS_PATH=freerdp-1.0-nevo/libs/armeabi-v7a
LOCAL_MODULE := freerdp-utils
LOCAL_SRC_FILES := $(MY_LIBS_PATH)/libfreerdp-utils.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/freerdp-1.0-nevo/include
include $(PREBUILT_STATIC_LIBRARY)
...

错误信息:

FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
java.lang.Class.newInstanceImpl(Native Method)
java.lang.Class.newInstance(Class.java:1319)
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
android.app.ActivityThread.access$600(ActivityThread.java:141)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:137)
android.app.ActivityThread.main(ActivityThread.java:5041)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:511)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
dalvik.system.NativeStart.main(Native Method)
java.lang.UnsatisfiedLinkError: Couldn't load freerdp from loader dalvik.system.PathClassLoader[dexPath=/data/app/net.itskewpie.freerdp-2.apk,libraryPath=/data/app-lib/net.itskewpie.freerdp-2]: findLibrary returned null
java.lang.Runtime.loadLibrary(Runtime.java:365)
java.lang.System.loadLibrary(System.java:535)
net.itskewpie.freerdp.FreeRDPActivity.<clinit>(FreeRDPActivity.java:16)
... 15 more

最佳答案

试试这个开源项目:

www.freerdp.com

关于Android SDK 应用加载库失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15249970/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com