我想在我的Android Studio项目中使用mudf来查看/编辑PDF文件,我正按照http://www.mupdf.com/docs/how-to-build-mupdf-for-android的说明操作。我正确设置了SDK和NDK,并将local.properties文件配置为指向正确的相应路径。现在,当我运行ndk-build时,我得到以下输出:
armeabi-v7a] Compile thumb : mupdfthirdparty <= cff.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= type1cid.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= psaux.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= pshinter.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= psnames.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= raster.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= smooth.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= sfnt.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= truetype.c
[armeabi-v7a] Compile thumb : mupdfthirdparty <= type1.c
[armeabi-v7a] StaticLibrary : libmupdfthirdparty.a
[armeabi-v7a] SharedLibrary : libmupdf_java.so
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/printf.c:29: error: undefined reference to '__isinff'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:332: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:227: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsparse.c:869: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsdate.c:318: error: undefined reference to '__isfinite'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsnumber.c:40: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/json.c:107: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsvalue.c:14: error: undefined reference to '__isinf'
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../thirdparty/mujs/jsvalue.c:226: error: undefined reference to '__isinf'
collect2: error: ld returned 1 exit status
make: *** [/Users/aayushkothari/Codes/mupdf/platform/android/viewer/obj/local/armeabi-v7a/libmupdf_java.so] Error 1
根据How to set standard c99 for compile android NDK project的答案,我修改了我的Application.mk文件以包含行APP_CFLAGS += -std=c99
当我再次运行ndk-build时,我得到以下内容:
[armeabi-v7a] Compile thumb : mupdf_java <= mupdf.c
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/mupdf.c: In function 'Java_com_artifex_mupdfdemo_MuPDFCore_getFocusedWidgetSignatureState':
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/mupdf.c:2361:2: warning: implicit declaration of function 'pdf_signatures_supported' [-Wimplicit-function-declaration]
if (!pdf_signatures_supported())
^
[armeabi-v7a] Compile thumb : mupdfcore <= bbox-device.c
[armeabi-v7a] Compile thumb : mupdfcore <= bidi-std.c
[armeabi-v7a] Compile thumb : mupdfcore <= bidi.c
[armeabi-v7a] Compile thumb : mupdfcore <= bitmap.c
[armeabi-v7a] Compile thumb : mupdfcore <= buffer.c
[armeabi-v7a] Compile thumb : mupdfcore <= colorspace.c
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c: In function 'fast_cmyk_to_rgb_ARM':
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:2: error: 'asm' undeclared (first use in this function)
asm volatile(
^
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:2: note: each undeclared identifier is reported only once for each function it appears in
/Users/aayushkothari/Codes/mupdf/platform/android/viewer/jni/../../../../source/fitz/colorspace.c:410:6: error: expected ';' before 'volatile'
asm volatile(
^
make: *** [/Users/aayushkothari/Codes/mupdf/platform/android/viewer/obj/local/armeabi-v7a/objs/mupdfcore/__/__/__/__/source/fitz/colorspace.o] Error 1
经过一番搜索后,我将-c99更改为-gnu99并再次运行ndk-build,只是为了再次获得初始错误。
我需要更改/添加什么来摆脱这些,以及一般来说,Android新手应遵循哪些步骤在现有Android Studio项目中包含muPDF?
答案 0 :(得分:1)
关于__isinff等问题的第一个问题是我相信64位android NDK的已知问题,或者至少与Google故意对NDK进行的一些更改有关。
如果你恢复到较旧的32位ndk,它应该可以工作 - 例如:
http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin
将它添加到您的Application.mk也可能有所帮助:
APP_PLATFORM := android-9
请参阅,例如https://groups.google.com/forum/#!topic/android-ndk/L2gc5HRq_dA