Reputation: 1645
Yesterday afternoon, I created a Xamarin forms project using the standard blank template.
When I attempt to deploy the project to an Android emulator running version 4.4, the following exception is thrown:
Android.Content.Res.Resources+NotFoundException: 'File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f070059'
This occurs on the line of code base.OnCreate(savedInstanceState);
in MainActivity.cs
in the Android project.
A forum post (here) seems to indicate that this is caused by an unsupported (older) version of Android. This seems plausible as it will work if I run the application on a later version. My understanding is that 4.4 is still supported so I am not sure what the issue is. I commented on this forum post but was not sure if anyone would see it as it was marked as resolved.
I marked this question with the Prism tag but it is not a Prism issue. I thought maybe someone from the Prism realm might be able to tell me what is going on since the Prism template is working.
Upvotes: 3
Views: 1078
Reputation: 15816
After some research, I found there is an know issue listed in the Xamarin.Andorid release note:
GitHub 3314: "Java.Lang.Exception: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f080058
" will abort app execution on Android 4.4 KitKat (API level 19) or lower for apps built with AAPT2 that use Android Support Libraries.
Workaround:
Add the --no-version-vectors
option to the $(AndroidAapt2LinkExtraArgs)
MSBuild property in your .csproj
file:
XML
<PropertyGroup>
<AndroidAapt2LinkExtraArgs>--no-version-vectors</AndroidAapt2LinkExtraArgs>
</PropertyGroup>
Then clean and rebuild the project.
Follow the Github thread or the new release note to check the process of this issue:xamarin/xamarin-android/pull
Upvotes: 13