简体   繁体   English

导出mupdf和android studio 0.5.4

[英]export mupdf and android studio 0.5.4

First: I want to view pdf files in my android app. 第一:我想在我的Android应用程序中查看pdf文件。 I googled and analyzed and decided to use mupdf For a start I use this guide to build demo project and it's work fine in eclipse. 我用Google搜索并分析并决定使用mupdf一开始我使用本指南构建演示项目,它在eclipse中工作正常。 But I need to run it in Android studio. 但我需要在Android工作室中运行它。 I try to export from eclipse as gradle project and import to Android Studio. 我尝试从eclipse导出为gradle项目并导入到Android Studio。 File explorer work, but when I opened pdf I get error: 文件浏览器工作,但当我打开pdf时,我收到错误:

 java.lang.ExceptionInInitializerError
        at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:213)
        at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:309)
        at android.app.Activity.performCreate(Activity.java:5008)
 ...
 Caused by: java.lang.UnsatisfiedLinkError: Couldn't load mupdf: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:365)
        at java.lang.System.loadLibrary(System.java:535)
        at com.artifex.mupdfdemo.MuPDFCore.<clinit>(MuPDFCore.java:14)
        at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:213)
        at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:309)

I try to just import project without convert it in Eclipse, but when I run application, I get error: 我尝试在Eclipse中导入项目而不转换它,但是当我运行应用程序时,我收到错误:

Error:Execution failed for task ':app:compileDebugNdk'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\\SpeedBoots\\android-ndk-r9d\\ndk-build.cmd NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\\mupdf\\platform\\android\\app\\build\\ndk\\debug\\Android.mk APP_PLATFORM=android-19 NDK_OUT=C:\\mupdf\\platform\\android\\app\\build\\ndk\\debug\\obj NDK_LIBS_OUT=C:\\mupdf\\platform\\android\\app\\build\\ndk\\debug\\lib APP_ABI=all Error Code: 2 Output: make.exe: * No rule to make target C:\\mupdf\\platform\\android\\app\\build\\ndk\\debug\\obj/local/armeabi-v7a/objs/mupdf/C_\\mupdf\\platform\\android\\app\\src\\main\\jni', needed by C:\\mupdf\\platform\\android\\app\\build\\ndk\\debug\\obj/local/armeabi-v7a/objs/mupdf/C_\\mupdf\\platform\\android\\app\\src\\main\\jni\\mupdf.o'. com.android.ide.common.internal.LoggedErrorException:无法运行命令:C:\\ SpeedBoots \\ android-ndk-r9d \\ ndk-build.cmd NDK_PROJECT_PATH = null APP_BUILD_SCRIPT = C:\\ mupdf \\ platform \\ android \\ app \\ build \\ ndk \\ debug \\ Android.mk APP_PLATFORM = android-19 NDK_OUT = C:\\ mupdf \\ platform \\ android \\ app \\ build \\ ndk \\ debug \\ obj NDK_LIBS_OUT = C:\\ mupdf \\ platform \\ android \\ app \\ build \\ ndk \\ debug \\ lib APP_ABI = all错误代码:2输出:make.exe: *没有规则来制作目标C:\\mupdf\\platform\\android\\app\\build\\ndk\\debug\\obj/local/armeabi-v7a/objs/mupdf/C_\\mupdf\\platform\\android\\app\\src\\main\\jni', needed by C:\\ mupdf \\ platform \\ android \\ app \\ build \\ ndk \\ debug \\ obj / local / armeabi-v7a / objs / mupdf / C_ \\ mupdf \\平台\\机器人\\程序\\ SRC \\主\\ JNI \\ mupdf.o”。 Stop. 停止。

  1. How to add mupdf library to Android Studio and in my project? 如何将mupdf库添加到Android Studio和我的项目中? I will appreciate any link, examples. 我会感谢任何链接,例子。 Any that could help. 任何有用的东西。
  2. How to import projects with native code to Android Studio? 如何将包含本机代码的项目导入Android Studio? I'm absolute noob in NDK and scare that I need to read tons of tutorial and books for just import project. 我是NDK中的绝对菜鸟,并且害怕我需要阅读大量的教程和书籍才能进行导入项目。

the errors you are getting seem to indicate that your .so files aren't getting integrated correctly into your APK. 您获得的错误似乎表明您的.so文件未正确集成到您的APK中。 You can check that by unzipping your APK and looking inside lib/armeabi-v7a , lib/x86 , etc 您可以通过解压缩APK并查看lib/armeabi-v7alib/x86等来检查

If there is only one .c or .cpp source file under jni/ folder, that may be the cause of this No rule to make target error, there is known bug on Windows: https://code.google.com/p/android/issues/detail?id=66937 如果jni/文件夹下只有一个.c或.cpp源文件,这可能是导致No rule to make target错误的原因,那么Windows上存在已知错误: https//code.google.com/p/安卓/问题/细节?ID = 66937

If you run into other troubles with Android Studio and the NDK, I've made an article that may help you here: http://ph0b.com/android-studio-gradle-and-ndk-integration/ 如果您遇到Android Studio和NDK的其他问题,我已经发表了一篇文章可以帮助您: http//ph0b.com/android-studio-gradle-and-ndk-integration/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM