The APK failed to install. Error: Could not parse error string

后端 未结 3 725
甜味超标
甜味超标 2021-02-11 12:14

Dragging and dropping an Android Package *.APK into an AVD (Android Virtual Device) throws a cryptic error:

The APK failed to install.
Error: Could not parse err         


        
3条回答
  •  被撕碎了的回忆
    2021-02-11 12:43

    After spending a rather long time suffering from this problem myself after building an apk using p4a using the armeabi-v7a flag, I discovered the problem, as outlined in @Melquiades answer, the default emulator uses x86 architecture, so of course it won't be compatible.

    The solution is to build you apk for x86, which you can do by specifying such in the p4a creation command using the arch flag - --arch=x86. You can see the available options here: https://github.com/kivy/python-for-android/blob/master/pythonforandroid/archs.py

    Personally, running python3crystax ndk with any flag other than armeabi-v7a failed to find the appropriate binaries. Running using python3 and the android ndk likewise failed for all architectures.

    If you are using python3 and would like to build for all architectures, you can use buildozer. Specifiy python3crystax in the buildozer.spec requirements, link the ndk directory on the android.ndk_path line and specify your chosen architecture on the line

    # (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
    android.arch = x86
    

    install python 3.5 following this tutorial: https://tecadmin.net/install-python-3-5-on-ubuntu/. You may need to downgrade or upgrade your cython version, depending on your current setup. Note that 0.27, 0.27.2 both don't work with Kivy. I found cython 0.25.2 worked for me. You can remove your previous version and install you chosen with:

    sudo pip3 install -U --force-reinstall cython=0.25.2
    

    If you're running on Ubuntu of course :)

    And there you have it. You would need to create multiple apks for the different architectures by changing the arch option in your buildozer.spec and running buildozer android debug for each architecture. You can still release to the play store as Google has the option to upload multiple apks: https://developer.android.com/google/play/publishing/multiple-apks.

    Good luck ;P

    EDIT python-for-android commands using SDK 20 / API 26 / NDK 15c / Python 3.7 and SDK 20 / API 24 / NDK 14b / Python 3.7 work. I have not personally tested the latter but more info can be found in this python-for-android post. Having tested the former, I can verify it works but does not support sqlite3.

提交回复
热议问题