How to optimize apk per ABI when using xamarin and visual studio? - android

I have a xamarin forms solution with visual studio 2019 on mac.
I try to publish my apk on google play console but it says that they are Unoptimised APK.
In visual studio, I went to Android project options > Android Build.
In release configuration, I checked Generate one package (apk) per select ABI. In the advanced tab, I checked the 4 supported ABI. Then I published and then uploaded 4 apks to google play console.
It doesn't seem to be enough, the website advises me to:
- Use the Android App Bundle to automatically optimise for device configurations (Not sure it is supported for xamarin solution)
- or manage it yourself with multiple APKs (which I did with no success)
I cannot ignore the warning, the button to go to next step is grayed.

Unfortunately Xamarin Android does not yet support App Bundles.
They are working on it and will be available soon:
https://github.com/xamarin/xamarin-android/issues/2727
The PR for the build task is already merged: https://github.com/xamarin/xamarin-android/pull/3146
if you want to try the preview version you can try this (from the Xamarin team):
you should be able to download a visx from our CI system via the Build Status section of our README.md (see https://github.com/xamarin/xamarin-android#build-status) and then picking a Job and going to the Azure Artifacts page. Or just use this to get the latest stable build https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/lastStableBuild/Azure/
Note that these will be the Open Source bits only. So some things (like fast deployment) won't work. But if you are building a release app that should be ok.
The only thing you can do until the App Bundles support will be released, is to use one APK per ABI and ignore the warning from Google Play
Until all your GRAY CHECKS in Google Play Console (on the left side menu ) become green, you will not be allowed to publish in play console and ignore the warning.

New in Visual Studio 2019 for windows 16.4 and for Mac 8.4
added support for building android app package aab format

Related

Unity ar.core.depth show unsuppported on device via bundle but works with apk

I have application with AR features, I mostly tested by generating apk and installing on device, and everything works fine, I tested on Galaxy Tab a7.
But now I want to publish in google play, I create app bundle, and in bundle explorer it shows that Galaxy Tab A7 is unsupported because of these 2 features:
android.hardware.camera.ar
com.google.ar.core.depth
I tried to set it to required="false" but then I got error:
The ArCore
dependency type com.google.ar.core is missing from
AndroidManifest.xml, although the meta-data tag
com.google.ar.core.min_apk_version has been specified.
But I didn't found any min_apk_version in any files.
For some reason changes in Android Studio didn't help. But when I made changes in
Unity->Project Settings->XR Plugin Management
ARCore,ArKit to optional instead required
And export project for Android Studio, with "Export for App Bundle" option it became fine.
I uploaded new bundle to Play Console, and list of devices increased.
I was facing this issue for weeks: my app was not considered compatible on my Galaxy A6 although I've always tested the app on it through direct apk build.
Contacted support but it didn't help (at first they were convinced I was misspelling the app name in the search bar, only after many email they recognised a compatibility problem but without addressing me). I checked and rechecked my Player Settings without luck.
I was about to give up and then I came here and figured out that my "mistake" was to build the app bundle release directly from Unity. It seems that some Player Settings are not properly transferred on the App Bundle release (the aab file) when built directly from Unity. So, as suggested, I tried to export on Android Studio checking Export Project and Export for App Bundle in Build Settings. Then I opened the exported project with Android Studio changing the build type from debug to release (it is another "ghost setting" not transferred by Unity). So I built the project with Android Studio, uploaded on Play Store and volà, hundreds of devices now compatible.
I think Google and Unity Technology really need to syncronize the way they handle app bundle builds..

Appcenter can't find APK file

I have this weird error, I've been using appcenter for a long time, but never experienced this.
I setup a build with appcenter which fetches from azure devops repo. The application is a Xamarin.Android native application. Once I run the build, everything goes well. Untill the signin step. When the step is about to start, I get this error:
##[error]No matching files were found with search pattern: /Users/runner/work/1/s/**/*.apk
Looks like the APK was not found, though the build runs successfully without error.
Please I need your help to figure out a solution to this issue.
In your csproj file for the Android Application project. Check whether <AndroidPackageFormat>apk</AndroidPackageFormat> is set to apk or aab. If it is aab then you need to change the search pattern to search for /**/*.aab instead. Otherwise, it will be looking for stuff that wasn't produced during the build.
To change the search path of appcenter, go to your build configurations and toggle the switch with label: “Build android app bundle”.
the change <AndroidPackageFormat>aab</AndroidPackageFormat> for <AndroidPackageFormat>apk</AndroidPackageFormat> works for me
If you are developing Android Apps and publishing them through Play Store, starting August 2021, new apps are required to target API level 30 (Android 11) and use the Android App Bundle publishing format. (aab)
If you want to know more about the Android App Bundle publishing format, here you have more information. As Cheesebaron is mentioning, if you are using AppCenter for building and packaging your Apps, just use the flag "Build App Bundle" in the Build configuration

Can't publish Xamarin.Forms App's APK file on Google Play Store

I want to publish my Xamarin.Forms App to Google Play Store. But when I upload the APK it gives me warning and disables roll-out option. It says we need to use Android App Bundle (.aab) format so that APK can be optimized for size and resources.
Currently, Visual Studio 2019 Archive option does not support the Android App Bundle. I have taken latest update of Visual Studio 2019 but still above format is not supported.
I googled and found some link to do this from the command prompt by modifying some settings in the Project file. But the build returns errors after couple of minutes with exit code 1.
This is frustrating as I can't publish it to Google Play Store. I have already published the iOS version of App.
Any help here will be very much appreciated.
Me and my team are currently releasing to Google Play with no problems our app as APK.
The App Boundle is a nice way to release smaller applications by delivering just what the device that downloads your application needs. The Xamarin Show published recently a video on this topic, that could be of interest for you:
https://www.youtube.com/watch?v=_IOZ0SUKZq4
Through the following images i show how we upload/publish our APK:
First, in the image below you see that APKs are still supported:
APK uploads correctly:
Then we are able to save and review the APK:
APK is uploaded with warning:
The warning states:
For now we just ignore the warning and go on to roll out:
In case that after following those steps your Start Rollout option is not yet enabled, it might be the case that you still have some other Listing Sections for your Application. After you introduce all the information required by Google, the Start Rollout option must be available.

Issue in generating the Release APK in Visual Studio for Xamarin.Form Application

I am working on Xamarin.Form application(Android and iOS). Want to generate the APK file in release mode to upload into the Google Play store.
I have followed the instruction of this Microsoft docs article & getting below Exception
Google Play Store: Authorize: The type initializer for
'Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception
I have already tried following things
Clean my entire solution.
Deleted and re-added the Newtonsoft.Json package(tried with both an older version and new versions)
Added the Newtonsoft.Json dll in Skip linking
assemblies under Android Options in Properties.
Please Check this
As a workaround you should be able to make an ad-hoc .APK and upload that to Google Play.
https://developer.xamarin.com/guides/android/deployment,testing,_and_metrics/publishing_an_application/part_3-_publishing_an_application_on_google_play/manually-uploading-the-apk/
I would advise to upgrade Visual Studio, since many problems reported referred to an older version.

Can't distribute apk to Google Store with desired architectures

I've made a Xamarin Android app in Visual Studio 2015 Community with Xamarin.
Until recently, I could publish it with no problems for beta testing and I had ~10.000 supported devices.
After I've updated Xamarin to 4.3.0.784, the publish option was replaced by Build>Archive. When I use this new option and distribute my app to Google Store, I have just 1632 supported devices.
I've noticed that on the APK Details page in Google Developer Console, it lists just arm64-v8a as "Native Platforms". In my previous builds that worked, I had all 5 platforms. No matter what supported architectures I select in Visual Studio project properties > Android Options> Advanced, after I distribute APK Details in Developer Console shows arm64-v8a.
Am I missing something or there's a bug in the new tools? What I want to achieve is to have an application in store with the supported architectures that I've selected in VS, so I won't be limited to the 1632 devices.
In the end, I distributed it ad hoc to my drive, zipaligned it manually and uploaded it. It gave a bunch of errors about devices being served by more than 1 version of the APK when trying to publish. Apparently, the VS publishing process messed with the version codes also (I had 1,2,3,4,5 , now they are something like 232329, 232932 etc.) Some are for all platforms, some just for 64bit and I can't explain how that happened.
I still can't publish because of this error and I ran out of patience to surf the net all day so I can use the Build->Archive feature. So I created a new application and uploaded the apk by hand. (this app is in beta so it's ok to make another one). Everything is fine with the new one, 12.000 devices supported for the same APK that had 1600 devices supported.
Still don't understand what happened but it looks bad.
I consider this topic closed.

Categories

Resources