【发布时间】:2011-08-27 03:47:43
【问题描述】:
我从 git 存储库 http://sourceforge.net/projects/crengine/ 签出了coolreader 3。 我尝试在eclipse中构建它,但是在运行时它崩溃并出现以下错误:
应用程序 Cool Reader (process.org.coolreader) 意外停止。请重试。
这是来自 logcat 的红色部分:
08-27 02:54:24.553:错误/AndroidRuntime(223):未捕获的处理程序:线程 BackgroundThread44c32540 由于未捕获的异常而退出 08-27 02:54:24.583: 错误/AndroidRuntime(223): java.lang.UnsatisfiedLinkError: 找不到库 cr3engine-45-15 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 java.lang.Runtime.loadLibrary(Runtime.java:489) 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 java.lang.System.loadLibrary(System.java:557) 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 org.coolreader.crengine.Engine.installLibrary(Engine.java:837) 08-27 02:54:24.583: 错误/AndroidRuntime(223): at org.coolreader.crengine.Engine.init(Engine.java:745) 08-27 02:54:24.583: 错误/AndroidRuntime(223): at org.coolreader.crengine.Engine.access$10(Engine.java:742) 08-27 02:54:24.583: 错误/AndroidRuntime(223): at org.coolreader.crengine.Engine$4.run(Engine.java:565) 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 android.os.Handler.handleCallback(Handler.java:587) 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 android.os.Handler.dispatchMessage(Handler.java:92) 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 android.os.Looper.loop(Looper.java:123) 08-27 02:54:24.583: 错误/AndroidRuntime(223): 在 org.coolreader.crengine.BackgroundThread.run(BackgroundThread.java:120)这是函数 org.coolreader.crengine.Engine.installLibrary:
private void installLibrary() {
try {
if (force_install_library)
throw new Exception("forcing install");
// try loading library w/o manual installation
log.i("trying to load library " + LIBRARY_NAME
+ " w/o installation");
System.loadLibrary(LIBRARY_NAME);
// try invoke native method
//log.i("trying execute native method ");
//setHyphenationMethod(HYPH_NONE, new byte[] {});
log.i(LIBRARY_NAME + " loaded successfully");
} catch (Exception ee) {
log.i(SO_NAME + " not found using standard paths, will install manually");
File sopath = mActivity.getDir("libs", Context.MODE_PRIVATE);
File soname = new File(sopath, SO_NAME);
try {
sopath.mkdirs();
File zip = new File(mActivity.getPackageCodePath());
ZipFile zipfile = new ZipFile(zip);
ZipEntry zipentry = zipfile.getEntry("lib/armeabi/" + SO_NAME);
if (!soname.exists() || zipentry.getSize() != soname.length()) {
InputStream is = zipfile.getInputStream(zipentry);
OutputStream os = new FileOutputStream(soname);
Log.i("cr3",
"Installing JNI library "
+ soname.getAbsolutePath());
final int BUF_SIZE = 0x10000;
byte[] buf = new byte[BUF_SIZE];
int n;
while ((n = is.read(buf)) > 0)
os.write(buf, 0, n);
is.close();
os.close();
} else {
log.i("JNI library " + soname.getAbsolutePath()
+ " is up to date");
}
System.load(soname.getAbsolutePath());
//setHyphenationMethod(HYPH_NONE, new byte[] {});
} catch (Exception e) {
log.e("cannot install " + LIBRARY_NAME + " library", e);
}
}
}
engine.java 中的第 837 行:
System.loadLibrary(LIBRARY_NAME);
engine.java 中的LIBRARY_NAME 由以下人员设置:
静态最终私有字符串 LIBRARY_NAME = "cr3engine-45-15";
因为我从存储库下载了代码,所以它应该可以在没有任何修改的情况下工作。我不明白为什么它不起作用。
【问题讨论】:
标签: android android-ndk