apk failed to install in emulator and andriod phone

Xinhwang 1 Reputation point
2021-11-10T09:52:55.43+00:00

Hello everyone.
I am a beginner of Android app developer. I am using Visual Studio 2019 community to create a android app by using Xamarin Form. The app works fine in Emulator in both debug and release mode. Then I successfully rebuild in Release mode and archive an apk file, but this apk is failed to install in the Emulator ( by dropping the apk file to Emulitor) and Android phone ( by copying the apk to phone and installing). For test purpose, I also used VS2019 to create a default Mobile App (Xamarin.Forms) and then build and archive it. I got the same problem.

By the way, I following the instruction in https://learn.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/?tabs=windows, but the problem still exists.

Does anyone could help me? Thanks a lot.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,376 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 79,471 Reputation points Microsoft Vendor
    2021-11-11T02:27:00.507+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Based on your error, I find a way to fix it

    In your AndroidManifest.xml, add android:extractNativeLibs="true" to the <application> tag the following parameter:

       <application android:label="TestArchieApp.Android" android:theme="@style/MainTheme" android:extractNativeLibs="true"></application>  
    

    This is due to a change in the android gradle plugin, which changed the default value from true to false in Version 3.6.0 (Source: https://developer.android.com/guide/topics/manifest/application-element#extractNativeLibs).

    And when re-build your application. If you get the following error.

       Error Found tag id where item is expected  
    

    Please enable the Use incremental Android packaging system(aap2) in the Android Options tag. and Linking set to None

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.