2014-06-15 58 views
2

我想爲我的android應用程序使用MuPDF。爲了構建它,我下載了源碼,cygwin和android ndk。無法爲android構建Mupdf(ExceptionInitializerError)

節省NDK和MUPDF源到我的F後:\驅動器,我跑了這一點:

Prepare the source

Check out a copy of the mupdf source from git:

~/src $ git clone git://git.ghostscript.com/mupdf.git Check out the third party library submodules:

~/src/mupdf $ git submodule update --init Populate the generated directory with the necessary files:

~/src/mupdf $ make generate Build and debug

Change into the platform/android directory and edit the local properties configuration file.

~/src/mupdf $ cd platform/android ~/src/mupdf/platform/android $ cp local.properties.sample local.properties ~/src/mupdf/platform/android $ nano local.properties

另注,複製local.properties後,我加入這一行:

sdk.dir=D:\\adt-bundle-windows-x86\\sdk 

其中D:\ adt-bundle-windows-x86 \ sdk是我的android sdk所在的位置。

我從MuPDF網站本身得到了上述內容。 在構建源,我得到這個: Possible error while building

在那之後,我從進口mupdf /源/平臺的代碼/安卓/我的日食workspace.The項目建立精細和PDF選擇器打開,因爲它應該;但是,當我選擇一些pdf,它崩潰與以下錯誤:

06-15 10:34:43.267: E/AndroidRuntime(16870): FATAL EXCEPTION: main 06-15 10:34:43.267: E/AndroidRuntime(16870): java.lang.ExceptionInInitializerError 06-15 10:34:43.267: E/AndroidRuntime(16870): at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:213) 06-15 10:34:43.267: E/AndroidRuntime(16870): at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:309) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.Activity.performCreate(Activity.java:5008) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.ActivityThread.access$600(ActivityThread.java:130) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.os.Handler.dispatchMessage(Handler.java:99) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.os.Looper.loop(Looper.java:137) 06-15 10:34:43.267: E/AndroidRuntime(16870): at android.app.ActivityThread.main(ActivityThread.java:4745) 06-15 10:34:43.267: E/AndroidRuntime(16870): at java.lang.reflect.Method.invokeNative(Native Method) 06-15 10:34:43.267: E/AndroidRuntime(16870): at java.lang.reflect.Method.invoke(Method.java:511) 06-15 10:34:43.267: E/AndroidRuntime(16870): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 06-15 10:34:43.267: E/AndroidRuntime(16870): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 06-15 10:34:43.267: E/AndroidRuntime(16870): at dalvik.system.NativeStart.main(Native Method) 06-15 10:34:43.267: E/AndroidRuntime(16870): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load mupdf: findLibrary returned null 06-15 10:34:43.267: E/AndroidRuntime(16870): at java.lang.Runtime.loadLibrary(Runtime.java:365) 06-15 10:34:43.267: E/AndroidRuntime(16870): at java.lang.System.loadLibrary(System.java:535) 06-15 10:34:43.267: E/AndroidRuntime(16870): at com.artifex.mupdfdemo.MuPDFCore.(MuPDFCore.java:14)

這裏怎麼回事? 我使用Cygwin和我運行Windows 7

我打算使用mupdf作爲一個庫渲染PDF文件

回答

1

你logcat中清楚地表明,它是「產生的原因:java.lang.UnsatisfiedLinkError中:無法加載mupdf:「,即因爲無法加載」libmupdf.so「庫而失敗。

確保您已正確地遵循the MuPDF documentation page上的所有步驟。確保所有命令都能成功運行而不會出現任何錯誤。看看你的終端(命令提示符)截圖,看起來「make」命令失敗。

在ndk-build步驟之後,必須生成「libmupdf.so」,確保它在你的Android項目文件夾中/庫/ armeabi-V7A/

+1

,但我一直在遵循這一鏈接 你能告訴我究竟錯在哪裏 –

+0

,我也看着我armeabi-V7A 什麼是錯的一個libmupdf.so ???。?: / –