question

DenGrigorenko-7207 avatar image
0 Votes"
DenGrigorenko-7207 asked JarvanZhang-MSFT commented

Using AndroidVersionCodePattern, possible to modify predefined abi?

Hello,

Is it possible to change predefined values for {abi} in csproj AndroidVersionCodePattern value?

According to

https://devblogs.microsoft.com/xamarin/advanced-android-versioncode/#androidversioncodepattern

we have following values:

ABI – Inserts the targeted ABI for the app

 1 - armeabi
 2 - armeabi-v7a
 3 - x86
 4 - arm64-v8a
 5 - x86_64


Our app using own pattern and in our pattern abi part ov versionCode based on other values:
07 - armeabi-v7a
08 - arm64-v8a
86 - x86
87 - x86_64

How to define AndroidVersionCodePattern to fit our own pattern?

dotnet-android
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, DenGrigorenko-7207. As the doc describes, AndroidVersionCodeProperties supports for allowing us to define our own {token} has also been added. This is done via the $(AndroidVersionCodeProperties). This is a comma-separated token=value pair string which defines the new {token} and its value. It will make use of the custom {token} values in the final APK versionCode.

Try using the AndroidVersionCodeProperties property to re-define the value.

0 Votes 0 ·

Hi JarvanZhang-MSFT,

We use following params:

  • AndroidSupportedAbis=x86_64;x86;armeabi-v7a;arm64-v8a

  • AndroidCreatePackagePerAbi=true

  • AndroidVersionCodePattern={abi}{versionCode:D4}

As a result of build, we get 4 APKs. But version code of these APKs does not fit our pattern (please see first message of this topic). How we can redefine {abi} values and use one build to get 4 APKs with correct version codes?


0 Votes 0 ·

According to the doc, the AndroidVersionCodePattern is string value such as`AndroidVersionCodePattern=2000001`. The Abis' value should be 2,3,4,5. It seems you set other values for the abi.

AndroidVersionCodeProperties property allows to update an item's value, try using the code like below:

<AndroidVersionCodeProperties>abi=3</AndroidVersionCodeProperties>

Here is the related doc:
https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-properties#androidversioncodepattern

0 Votes 0 ·

AndroidVersionCodeProperties property allows to update an item's value, try using the code like below:
<AndroidVersionCodeProperties>abi=3</AndroidVersionCodeProperties>

And then you build such csproj with parameters:
- <AndroidSupportedAbis>x86_64;x86;armeabi-v7a;arm64-v8a</AndroidSupportedAbis>
- <AndroidCreatePackagePerAbi>true<AndroidCreatePackagePerAbi>
- <AndroidVersionCodeProperties>abi=3</AndroidVersionCodeProperties>*
- <AndroidVersionCodePattern>{abi}{versionCode:D4}</AndroidVersionCodePattern>


result will be 4 APKs for different architectures, but with same version code. Is it possible to redefine abi during one build for each apks?

0 Votes 0 ·

Hi,DenGrigorenko-7207. The doc doesn't provide a detailed usage about the function code or a basic sample demo. It's suggested to start a topic on the github to seek for help from the product team.

0 Votes 0 ·

1 Answer

DenGrigorenko-7207 avatar image
0 Votes"
DenGrigorenko-7207 answered JarvanZhang-MSFT commented
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for sharing the link.

0 Votes 0 ·