Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

APK not getting installed after upgrading to AndroidX

I have migrated existing xamarin project to AndroidX ,by choosing the option from menu (Migrate to AndroidX). After that i encountered error due to missing reference of support library. I added Xamarin.Android.Support.Core.UI , Xamarin.Android.Support.CustomTabs, Xamarin.Android.Support.v7.RecyclerView and build issues resolved. Able to run the app locally in emulator in Debug and Release Mode. But if i tries to install the apk, it doesnt get installed. @JamesMontemagno @JohnMiller @JonDouglas @jezh
TIA.

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited November 19

    But if i tries to install the apk, it doesnt get installed

    Did any error occur? Such as 'App not installed'. Try to uninstall the previous application on the device and clear the cache, then install the apk again.

    After that i encountered error due to missing reference of support library.

    This is because after migrating to AndroidX, we need to make some manual namespace changes for scenarios. To migrate to AndroidX, try to reference the AndroidX libraries. If the application does not include any dependencies that require AndroidX namespace migration, you can use the AndroidX libraries on NuGet.
    Check the link:
    https://docs.microsoft.com/en-us/xamarin/android/platform/androidx#migration-tooling

  • JarvanJarvan Member, Xamarin Team Xamurai

    Try to set android:extractNativeLibs to true in the AndroidManifest.xml.

    android:extractNativeLibs="true"
    

    Refer to: https://stackoverflow.com/a/63684011/11083277

  • JovanoJovano USMember ✭✭

    I had the same symptoms, followed the same process and received the message 'the apk is corrupted' when trying to install the SIGNED apk on a device. What baffled me was that I could copy my solution to a second pc and I was able to compile and create a valid signed apk on this pc without making any changes to the solution. The apk was also approx 10mb smaller when compiled on this pc. So it had to be something environmental.

    Finally found this thread on the forum and after setting android:extractNativeLibs="true" in the AndroidManifest.xml, the first pc was also creating a valid apk, which was now even smaller in size than the apk compiled on the second pc.

    So now I'm just left wondering: Why did it work on the second PC without this setting in the manifest? :open_mouth:

Sign In or Register to comment.