Android的JNI加载mupdf(与NDK编译?) [英] android JNI loading mupdf (compile with NDK?)

查看:194
本文介绍了Android的JNI加载mupdf(与NDK编译?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个Android Xoom的应用程序,它显示在活动中的一个PDF文件。

I am creating an Android Xoom application which displays a pdf in one of the Activities.

我已经下载了mupdf源文件:mupdf.c,Android.mk,Application.mk,Core.mk和ThirdParty.mk

I have downloaded the mupdf source files: mupdf.c, Android.mk, Application.mk, Core.mk, and ThirdParty.mk.

我也去过mupdf.com网站,并试图从这里下载各种pre编译包:的 http://ccxvii.net/mupdf/download/

I have also been to the mupdf.com web site and tried downloading various pre-compiled packages from here: http://ccxvii.net/mupdf/download/

我刚换从iPhone到Android和有一些东西需要学习有关,包括C code。我把MK / C文件到/ JNI /在我的项目。我也试图在precompiled文件,我从网站上下载以上/ JNI /复制在我的项目。

I just switched to Android from the iPhone and have a few things to learn regarding including C code. I put the mk / c files into /jni/ in my project. I have also tried to copy the precompiled files I downloaded from the web site above in /jni/ in my project.

我有一个简单的类:

import android.graphics.*;

    public class PDFView {  
        static {
            System.loadLibrary("mupdf");
        }
    }

我每次创建此类应用程序崩溃的实例,它说的ExceptionInInitializerError以及无法加载mupdf:findLibrary返回null在LogCat中

Every time I create an instance of this class the app crashes and it says "ExceptionInInitializerError" as well as "Couldn't load mupdf: findLibrary returned null" in the LogCat.

我也下载了Android NDK,并试图自己编译源。我得到一个失踪mupdf.h错误和fitz.h错误。错误的只是整个名单,这似乎过于复杂,包括一个图书馆。

I have also downloaded the android NDK and tried to compile the source myself. I get a missing mupdf.h error and fitz.h error. Just a whole list of errors and this seems overly complicated to included a library.

我的工作在Mac雪豹上。我想我在正确的道路需要编译这是一个二进制的,但它一直很无奈花了这么长的时间学习NDK的话,就不会编译。也许我需要一个更新的源。

I am working on a Mac in Snow Leopard. I think I'm on the right path needing to compile this as a binary, but it's been really frustrating having spent all this time learning about the NDK then it won't compile. Maybe I need an updated source.

谁能帮我指出了正确的方向?

Can anyone help point me in the right direction?

推荐答案

您需要设置你正确地包含在你的Andr​​oid.mk路径

You need to setup your include paths properly in your Android.mk

请发表您的Andr​​oid.mk更多帮助,虽然在此期间,您可以尝试从NDK的样本中,这是包含在NDK文件夹。

Please post your Android.mk for more help, although in the meantime you can try to borrow from the NDK samples, which are included in your NDK folder.

先尝试建立他们作为一个全面的检查,然后看看在JNI / Android.mk看到自己的makefile如何设置。

Try building them as a sanity check first, then look in jni/Android.mk to see how their makefiles are setup.

在NDK的文档目录也包含在Android.mk文件伟大的文档。

The docs directory in the NDK also contains great documentation on the Android.mk file.

老实说,这将是很难使用NDK的,除非你是经验丰富的C.知道化妆,海湾合作委员会的来龙去脉,和LD是最重要的。

Honestly, it's going to be hard to use the NDK unless you are experienced in C. Knowing the ins and outs of make, gcc, and ld is of paramount importance.

修改 - 使这个过程更容易,我会克隆mupdf Git仓库。其实是有一个 Android项目有准备建造。

Edit - to make this process easier, I would clone the mupdf git repository. There is actually an Android project there ready to be built.

请确保您使用混帐做克隆,因为你想拥有所有必要的文件。自述对建筑的简单说明。这似乎是得到这个工作第一,调整它从那里可能是你一个更可靠的发展道路。

Make sure you use git to do the clone, as you want to have all of the necessary files. The readme has simple instructions on building. It seems like getting this working first and tweaking it from there might be a more reliable development path for you.

这篇关于Android的JNI加载mupdf(与NDK编译?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆