gpt4 book ai didi

java - dlopen ("xxxx")失败: dlopen failed: library "xxxx" not found

转载 作者:太空宇宙 更新时间:2023-11-04 13:45:20 26 4
gpt4 key购买 nike

package com.test.nativeapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends ActionBarActivity {

static {
try {
System.load("native/libkdu_jni.so");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}

LogCat 错误:

06-18 11:13:55.235: D/dalvikvm(17658): Trying to load lib native/libkdu_jni.so 0x421eeb38 06-18 11:13:55.235: E/dalvikvm(17658): dlopen("native/libkdu_jni.so") failed: dlopen failed: library "native/libkdu_jni.so" not found

06-18 11:13:55.235: W/System.err(17658): Native code library failed to load.

06-18 11:13:55.235: W/System.err(17658): java.lang.UnsatisfiedLinkError: dlopen failed: library "native/libkdu_jni.so" not found

我应该把这个文件夹放在哪里?

最佳答案

试试这个:

System.loadLibrary("kdu_jni");

loadLibrary()实际上是从ape的lib/加载的。另外,您不需要指定“lib”和扩展名“so”。

希望这有帮助。

关于java - dlopen ("xxxx")失败: dlopen failed: library "xxxx" not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30909922/

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