Search code examples
dockerkivybuildozer

Kivy - build APK with buildozer on Docker Desktop failed


I try to generate APK with Buildozer running in Docker container (Docker Desktop on Windows 10), but it fails anytime. The image was pulled from https://hub.docker.com/r/kivy/buildozer. When started with docker run --volume ${pwd}:/home/user/hostcwd buildozer init, then buildozer.spec is correctly created, but when I run docker run --volume ${pwd}:/home/user/hostcwd buildozer debug then all the fun ends with error message about missing API:

Unfortunately I'm also quite new in Docker... If I understand it correctly, then SDK and NDK should have been downloaded successfully during the process, but Android API is missing and I don't know how to install it.


Solution

  • The SDK and NDK are indeed downloaded, as you already guessed, but you must explicitly accept their licenses. You can do this in the buildozer.spec file if you set android.accept_sdk_license = True.

    I generated the buildozer.spec file in the working directory

    docker run --volume "$(pwd)":/home/user/hostcwd kivy/buildozer init
    

    Then I have set android.accept_sdk_license = True in buildozer.spec that was generated in the working directory:

    ...
    # (bool) If True, then automatically accept SDK license
    # agreements. This is intended for automation only. If set to False,
    # the default, you will be shown the license when first running
    # buildozer.
    android.accept_sdk_license = True
    
    # (str) Android entry point, default is ok for Kivy-based app
    #android.entrypoint = org.renpy.android.PythonActivity
    ...