Kivy应用程序的buildozer中存在NDK版本冲突



我正在尝试构建一个在buildozer.spec:中具有这些要求的kivy应用程序

requirements = python3,kivy,pillow,plyer,scipy,numpy

所有Android(SDK/NDK,API(设置均为默认设置(注释(

一次运行,不指定NDK给出:

[INFO]:    <- directory context /home/joachim/PycharmProjects/CardReader/.buildozer/android/platform/python-for-android
[WARNING]: install_libs called with no libraries to install!
[INFO]:    Building lapack for arm64-v8a
[INFO]:    -> directory context /home/joachim/PycharmProjects/CardReader/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/lapack/arm64-v8a__ndk_target_21/lapack/build
[ERROR]:   Build failed: Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (supported NDK version: 'r21e')

当我清理并将NDK设置为21e并再次运行时,我得到了另一个错误:

[INFO]:    Will compile for the following archs: arm64-v8a, armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 27
[INFO]:    Available Android APIs are (27)
[INFO]:    Requested API target 27 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/joachim/.buildozer/android/platform/android-ndk-r21e
[INFO]:    Found NDK version 21e
[ERROR]:   Build failed: The minimum supported NDK version is 23. You can download it from https://developer.android.com/ndk/downloads/.
[INFO]:    Instructions: Please, go to the android NDK page (https://developer.android.com/ndk/downloads/) and download a supported version.
*** The currently recommended NDK version is 23b ***

如何解决这种不匹配正在寻找支持gcc/gfortran的NDK或者,需要为LEGACY_NDK设置什么?

所以我刚刚遇到了这个问题并找到了解决方案
问题是,要为android构建scipy python,需要一个支持fortran构建的android ndk。这些似乎只有NDK版本21及更低版本才支持,NDK需要专门使用fortran支持构建。幸运的是,有人为此目的托管了预构建版本。https://github.com/mzakharo/android-gfortran/releases(仅限Linux,如果你从windows构建APK,你需要构建你自己的NDK工具链,如该项目的自述中所述(

然后你必须做以下事情:

首先,您需要通过buildozer下载遗留NDK对于buildozer.spec:中的此修改

#android.ndk = 23b --> android.ndk = 21e

然后执行

buildozer android debug

当它失败时(这是可以的,因为我们只运行buildozer下载r21 NDK(:

tar -jxvf gcc-arm-linux-x86_64.tar.bz2
mv arm-linux-androideabi-4.9 ~/.buildozer/android/platform/android-ndk-r21e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

注意:将~/.buildozer更改为buildozer存储ndks 的路径

然后将更改恢复为buildozer.spec:

android.ndk = 21e --> #android.ndk = 23b

现在您可以使用进行构建和部署

export LEGACY_NDK=~/.buildozer/android/platform/android-ndk-r21e
buildozer android debug deploy run

注意:如上所述更改~/.buildozer

相关内容

  • 没有找到相关文章

最新更新