构建 Android (Xamarin) 应用程序获取此错误:@mipmap-mdpi/myicon' 与属性图标 (attr) 引用不兼容 [英] Building Android (Xamarin) App Get this error: @mipmap-mdpi/myicon' is incompatible with attribute icon (attr) reference

查看:23
本文介绍了构建 Android (Xamarin) 应用程序获取此错误:@mipmap-mdpi/myicon' 与属性图标 (attr) 引用不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
        android:versionName="Version" package="com.xyz" android:installLocation="internalOnly" android:versionCode="11122222">
  <uses-sdk android:minSdkVersion="24" android:targetSdkVersion="30" />
  <uses-permission android:name="android.permission.INTERNET" />
  <application android:allowBackup="true" android:icon="@mipmap/ic_launcher_round" android:label="xyz" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:name="android.app.Application" android:debuggable="true">
    <activity android:icon="@mipmap-mdpi/myicon" android:label="xyz" android:theme="@style/AppTheme" android:name="crc3333640c4af442c.MainActivity">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <service android:name="crc3333640c4af442c.KeepAliveService" />
    <receiver android:enabled="true" android:exported="false" android:label="Essentials Battery Broadcast Receiver" android:name="crc3333640c4af442c.BatteryBroadcastReceiver" />
    <receiver android:enabled="true" android:exported="false" android:label="Essentials Energy Saver Broadcast Receiver" android:name="crc3333640c4af442c.EnergySaverBroadcastReceiver" />
    <receiver android:enabled="true" android:exported="false" android:label="Essentials Connectivity Broadcast Receiver" android:name="crc3333640c4af442c.ConnectivityBroadcastReceiver" />
    <provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="1999999999" android:authorities="com.xyz.mono.MonoRuntimeProvider.__mono_init__" />
    <!--suppress ExportedReceiver-->
    <receiver android:name="mono.android.Seppuku">
      <intent-filter>
        <action android:name="mono.android.intent.action.SEPPUKU" />
        <category android:name="mono.android.intent.category.SEPPUKU.com.yullencryption.alkemi" />
      </intent-filter>
    </receiver>
  </application>
  <queries>
    <package android:name="Mono.Android.DebugRuntime" />
    <package android:name="Mono.Android.Platform.ApiLevel_30" />
  </queries>
</manifest>

推荐答案

当您使用来自资源的文件时,您没有指定它应该使用哪个 DPI 文件夹.Android 会自行将设备 DPI 与文件夹进行匹配.因此,写mipmap-mdpi是错误的,它应该只是mipmap.

When you use files from resources you do not specify which DPI folder it should use. Android will on its own match the device DPI to the folder. Hence, writing mipmap-mdpi is wrong, it should simply be mipmap.

将您的图标更改为 @mipmap/myicon.

这篇关于构建 Android (Xamarin) 应用程序获取此错误:@mipmap-mdpi/myicon' 与属性图标 (attr) 引用不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆