androidmupdf

MuPDF compile for Android fails in generateJsonModelRelease


Following the steps in [1] make fails during the task :jni:generateJsonModelRelease arguing about missing architecture definitions. I already added APP_ABI := all to ${PROJECT_HOME}/jni/Application.mk with no luck.

$ make
ANDROID_HOME=/Users/paddel10/Library/Android/sdk ./gradlew assembleDebug
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
...
:jni:generateJsonModelRelease
/Users/paddel10/Library/Android/sdk/ndk-bundle/build/core/init.mk:537: *** Android NDK: Aborting...    .  Stop.
/Users/paddel10/Library/Android/sdk/ndk-bundle/build/core/init.mk:537: *** Android NDK: Aborting...    .  Stop.
/Users/paddel10/Library/Android/sdk/ndk-bundle/build/core/init.mk:537: *** Android NDK: Aborting...    .  Stop.
:jni:generateJsonModelRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':jni:generateJsonModelRelease'.
> Build command failed.
  Error while executing process /Users/paddel10/Library/Android/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/paddel10/Downloads/mupdf-android-viewer-mini/jni/libmupdf/platform/java/Android.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=/Users/paddel10/Downloads/mupdf-android-viewer-mini/jni/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/Users/paddel10/Downloads/mupdf-android-viewer-mini/jni/build/intermediates/ndkBuild/release/lib -j4 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
  Android NDK: INTERNAL ERROR: The armeabi ABI should have exactly one architecture definitions. Found: ''
  /Users/paddel10/Library/Android/sdk/ndk-bundle/build/core/init.mk:537: *** Android NDK: Aborting...    .  Stop.
  make[1]: Entering directory `/Users/paddel10/Downloads/mupdf-android-viewer-mini/jni'
  make[1]: Leaving directory `/Users/paddel10/Downloads/mupdf-android-viewer-mini/jni'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.06 secs
make: *** [assembleDebug] Error 1
$

$ ndk-build --version
GNU Make 3.81

[1] https://www.mupdf.com/docs/android-build-viewer.html


Solution

  • I finally managed to compile the sources. For this I had to adjust the property ndk.abiFilters in jni/build.gradle. In addition it seems as if armeabiisn't supported anymore.

    vi jni/build.gradle
    android {
      ...
      defaultConfig {
        ...
        ndk.abiFilters 'arm64-v8a'
      }
      ...
    }
    
    # don't forget to generate the sources in the jni directory
    cd jni
    make generate
    
    # compile
    cd ..
    make