Forum Xamarin.Android

How do I create apk file using Xamarin.Android.X?

Hi, I'm trying to generate apk with Xamarin.Android.X, but I'm getting a lot of errors. The project is deploying on the phone, but does not create apk.

Xamrin.forms - version: 4.8.0.1687
Xamarin.AndroidX.Migration - version: 1.0.8

Answers

  • ganesh96ganesh96 Member ✭✭✭

    Have you changed 'Debug' to 'Release'? If not, do that and run on the device/emulator.

  • jezhjezh Member, Xamarin Team Xamurai

    For this, you can check the official document Preparing an Application for Release first.

    You can use the following steps to build the app for release:

    • Specify the Application Icon – Each Xamarin.Android application should have an application icon specified. Although not technically necessary, some markets, such as Google Play, require it.

    • Version the Application – This step involves initializing or updating the versioning information. This is important for future application updates and to ensure that the users are aware of which version of the application they have installed.

    • Shrink the APK – The size of the final APK can be substantially reduced by using the Xamarin.Android linker on the managed code and ProGuard on the Java bytecode.

    • Protect the Application – Prevent users or attackers from debugging, tampering, or reverse engineering the application by disabling debugging, obfuscating the managed code, adding anti-debug and anti-tamper, and using native compilation.

    • Set Packaging Properties – Packaging properties control the creation of the Android application package (APK). This step optimizes the APK, protects its assets, and modularizes the packaging as needed. Additionally, you can provide your users with an Android App Bundle that's optimized for their devices.

    • Compile – This step compiles the code and assets to verify that it builds in Release mode.

    • Archive for Publishing – This step builds the app and places it in an archive for signing and publishing.

  • JoyPeterJoyPeter Member ✭✭

    @ganesh96 said:
    Have you changed 'Debug' to 'Release'? If not, do that and run on the device/emulator.

    Thanks for the answer.

    Yes, I changed.

  • JoyPeterJoyPeter Member ✭✭

    @jezh said:
    For this, you can check the official document Preparing an Application for Release first.

    You can use the following steps to build the app for release:

    • Specify the Application Icon – Each Xamarin.Android application should have an application icon specified. Although not technically necessary, some markets, such as Google Play, require it.

    • Version the Application – This step involves initializing or updating the versioning information. This is important for future application updates and to ensure that the users are aware of which version of the application they have installed.

    • Shrink the APK – The size of the final APK can be substantially reduced by using the Xamarin.Android linker on the managed code and ProGuard on the Java bytecode.

    • Protect the Application – Prevent users or attackers from debugging, tampering, or reverse engineering the application by disabling debugging, obfuscating the managed code, adding anti-debug and anti-tamper, and using native compilation.

    • Set Packaging Properties – Packaging properties control the creation of the Android application package (APK). This step optimizes the APK, protects its assets, and modularizes the packaging as needed. Additionally, you can provide your users with an Android App Bundle that's optimized for their devices.

    • Compile – This step compiles the code and assets to verify that it builds in Release mode.

    • Archive for Publishing – This step builds the app and places it in an archive for signing and publishing.

    Thanks for the answer.

    I used the steps.

  • JoyPeterJoyPeter Member ✭✭

    Now I can generate apk, but it doesn't install.

    My configurations

  • jezhjezh Member, Xamarin Team Xamurai

    Have you set the Minimum Android version and Target Android version correctly?
    For example:

    And try to recheck the Supported architectures

  • jezhjezh Member, Xamarin Team Xamurai

    Hi @JoyPeter , have you resolved your problem?

  • JoyPeterJoyPeter Member ✭✭

    @jezh said:
    Hi @JoyPeter , have you resolved your problem?

    HI
    Sorry, I was absent.
    No it didn’t solve the problem, these configurations are already done

  • jezhjezh Member, Xamarin Team Xamurai

    Since we couldn't reproduce this problem on our side , could you please share your detailed steps and screenshots with me?

  • JoyPeterJoyPeter Member ✭✭
    edited December 2020

    @jezh said:
    Since we couldn't reproduce this problem on our side , could you please share your detailed steps and screenshots with me?

    The application does not run in release mode but in debug mode it works.

    Config:

    Result

Sign In or Register to comment.