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 error string
Unknown sources are allowed
android.api = 24
android.minapi = 24
android.sdk = 24
“Parse Error: There was a problem parsing the package” is one of the oldest yet most common Android errors. It usually pops up when someone fails to install an application on an Android smartphone. Witnessing the Android error simply means the application cannot be installed due to the . apk parser, i.e. parsing issue.
If the APK file is Split into App bundles, ‘ Parsing Error ‘, is pretty common. Make sure the File is Not Split APK App Bundle. If it is a bundle then you need to install it using a Split Installer. Google introduced a new way to distribute Android apps called app bundles.
How to Fix Problem of Parse Error on Android? Step 1. Download the APK Editor app. Step 2. Now open APK Editor App and click on “Select an Apk File”. Now search for the app which you wish to install. Step 5. Click the app and select the “common edit” option.
The Android OS uses these data strings to run and install the apk file. Sometimes due to some issues with the build or due to manipulation of the file error occurs in-app installation. Why there is an Error in Parsing the Package?
If you've received a parse error and still want to install the app in question, you will have to identify and fix the root problem. What's the Cause of an Android Parse Error?
HOWEVER, if I upload this same APK to my actual Android Device, IT WORKS! Not only does it install, but it opens and runs my app just fine with no errors
This tells me it might be because your app uses native libraries which don't match the emulator cpu architecture (see this question)
To get a more detailed error message, install your app via terminal:
adb install path_to_your_app/name_of_your_app.apk
You might see this:
adb: failed to install name_of_your_app.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries
I was facing the same issue. The problem is, if the same application is already installed with the same version on the Emulator then it won't get update/install. it will throw the same error as you are getting it.
Try the following solutions to fix it.
Uninstall the old APK from Emulator and then drag & drop the new APK, it would install the application
Change the version number from Build.gradle file as suggested by @Chuy47, build the new APK and install it
Hope it helps.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With