question

StewartACBasterash-5010 avatar image
0 Votes"
StewartACBasterash-5010 asked RobCaplan edited

Android Manifest Build and Deploy

I am using the latest incarnation of Visual Studio 2019 (version 16.9.2). I am building a proof of concept automation tool. The code is literally the "tabbed" PCL template for Android ONLY in Visual Studio. I have altered the code just enough to save the List<item> to a JSON file... My simple requirement is to build a "foreground" service to "read" from the JSON file when a system event (aka Receiver) is raised... Everything seems to work just fine with one exception... I need to have the "service" read the file and create an Android PDU data item based on the JSON item element, and the data from the receiver data.. Everything has worked fine but it appears that I need to have a "File Provider" to make this work (based on what I am reading).

There are no errors thrown, but it has been conjectured that I require a File Provider, which entails altering the "manifest". No matter what I do, The Visual Studio compiler is not happy... Simply decorating the manifest with the <application></application> XML element causes the compiler to throw this error upon deployment...

XA0130: Sorry. Fast deployment is only supported on devices running Android 5.0 (API level 21) or higher.

My android emulator is at level 29... so... ??? If I adjust the android manifest property options and turn off "Fast Deployment" it begins to complain about other compiler settings... If I chase these down the app no longer compiles or functions at all... If I remove the application element and set everything back to startup settings... I am back to normal.

If I attempt to add the <Provider> element within the application element (which is the goal) it throws various other compiler errors and am absolutely dead in the water...

Can someone provide some insight? This is quite frustrating...

dotnet-xamarin
· 3
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.

Firstly, please make sure you put the File Provider if is correct, you can refer to this thread: https://github.com/jamesmontemagno/MediaPlugin#android-required-setup

And make sure you set the Minimum android version is Android 5.0 or later like this thread:

81771-image.png

If you have set above settings, please close your VS, open your project folder, delete all of the bin and obj folder, then reopen your project in VS, if you get the same issue.


0 Votes 0 ·
image.png (22.1 KiB)

That does not appear to have an effect... In this version of the VS tabbed template minimum version is Android 5.0. These are the defaults... and the result of removing the BIN and DEBUG folders... closing VS and reopening the project... It will compile, but will not deploy to the emu...

81707-untitled.png


0 Votes 0 ·
untitled.png (112.7 KiB)
LeonLu-MSFT avatar image LeonLu-MSFT StewartACBasterash-5010 ·

Could you share a demo?

0 Votes 0 ·

1 Answer

StewartACBasterash-5010 avatar image
0 Votes"
StewartACBasterash-5010 answered LucasJensen-1662 commented

The changes that you provided were the default for this template in VS... The problem was an error in the AndroidManifest.xml file. I was in fact able to compile and run the app on both the emu and a test device. This did not solve the problem at hand, but it did allow me to move forward.

Thank you for your assistance.

I also needed to resolve a follow-up issue associated with the Android Project Options related to "supported architectures". Once the file provider was entered correctly in the Manifest, the app threw another exception associated with the ABI that was being linked. I was forced to remove the first "arm" entry in order to get by this error as well.

· 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.

I found this issue is related to the VS update, And I update to the 16.9, I get the same issue when I debug my application with Huawei device.

here is GitHub thread about this issue: https://github.com/xamarin/xamarin-android/pull/4690#issuecomment-712122656

1 Vote 1 ·