Xamarin Android:此应用程序使用不正确的配置构建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Xamarin Android:此应用程序使用不正确的配置构建相关的知识,希望对你有一定的参考价值。

下午好,

我决定今天玩Xamarin,我一直有一些问题让Vector图像工作。我按照说明here并在我的布局中有以下内容:

<ImageView
    app:srcCompat="@drawable/fort"
    android:layout_height="wrap_content"
    android:id="@+id/imageView1" />

但是,我在运行时收到以下错误:

Unhandled Exception: Java.Lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat. occurred

在Google中抛出这个错误,我得到了一些链接,最值得注意的是this StackOverflow post,其中大多数答案都引用了原生Android SDK并包含Gradle文件修改,但我不确定。我从VS项目中看不到任何Gradle内容,所以我不确定是否应该编辑它们。

我该怎么做才能解决这个问题,是否正在修改Gradle配置?

答案

Xamarin.Android.Support.Vector.Drawable nuget package添加到您的Xamarin.Android项目中。

注意:Xamarin.Android.Support.Vector.Drawable nuget包中包含一个.targets文件,该文件将参数--no-version-vectors附加到AndroidResgenExtraArgs构建属性值,以确保将参数传递给aapt调用。

这基本上相当于编辑Gradle文件。在这里找到的信息:qazxsw poi

以上是关于Xamarin Android:此应用程序使用不正确的配置构建的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Xamarin 中使用 SetAction

加载程序集时Xamarin Android异常:System.IO.FileNotFoundException:无法加载程序集'Xamarin.Android.Support.Compat&#

关闭xamarin后保存android应用字符串值

Xamarin - 在android中截取屏幕截图

对于Xamarin Android,我无法处理点击事件的后台通知

启用 PROGUARD - Xamarin.Android