Problem parsing package with API level 31
I have spent a good chunk of time trying to look into every avenue to get this to work and really struggling now. So I am currently trying to build to API Level 31 on Unity 2021.2.1f1, It successfully builds and generated the APK file as intended however, When clicking to install on ANY android 12 device it starts the install process trying to parse the file however it comes back to say it failed to parse. To note running the same APK on any other version of android works perfectly fine this seems to just be android 12 issue. I am defiantly building for android 12 (API Level 31). I have even tried to export the project from unity to open and build the APK through android studio, Android studio will build the APK and when running on android 12 devices will get past the parsing issue and install correctly So i was thinking there must be something going wrong on unity's side of thing. I have tried to use the latest 2022 version of unity also with the issue being produced.
Also to note Android API Level 31 is fully installed correctly and it is selected manually in unity settings,I have spent a good chunk of time trying to look into every avenue to get this to work and really struggling now. So I am currently trying to build to API Level 31 on Unity 2021.2.1f1, It successfully builds and generated the APK file as intended however, When clicking to install on ANY android 12 device it starts the install process trying to parse the file however it comes back to say it failed to parse. To note running the same APK on any other version of android works perfectly fine this seems to just be android 12 issue. I am defiantly building for android 12 (API Level 31). I have even tried to export the project from unity to open and build the APK through android studio, Android studio will build the APK and when running on android 12 devices will get past the parsing issue and install correctly So i was thinking there must be something going wrong on unity's side of thing. I have tried to use the latest 2022 version of unity also with the issue being produced.
Also to Note i can confirm API Level 31 is selected and is installed
@jgratrix_lavaskull I have the same problem (though I'm using Unity 2019.2 - can not update). Tried API Level 31, 32 and highest installed - always the same parsing error on the Android Device. Did you find a solution?
Answer by botiloszlov12 · Feb 16 at 06:33 PM
Hi, this is my first comment ever on Unity forums, and I'm here because I found a solution that works for me:
In the Player Settings before building, at the Other Settings/Configuration tab you want to set the target API to Android 10.0. (Yes, even if you have a newer version.)
I don't know why, but it worked for me after pointlessly searching on every forum. In my case, a game was previously installed on the phone, then ever since the latest software update it got automatically deleted and the APK said "There was an error parsing the package". This solution helped without a problem.
Hope I helped at least one clueless person googling this question.
Your answer
Follow this Question
Related Questions
build android problem 1 Answer
Unable to merge android manifests 1 Answer
Android re-package error - CommandInvokationFailure 0 Answers
Unable to convert classes into dex format 12 Answers
AndroidManifest-main.xml merging error 6 Answers