Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

xamarin.android - Building Android (Xamarin) App Get this error: @mipmap-mdpi/myicon' is incompatible with attribute icon (attr) reference

Here's the Manifest:

<?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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

Change your icon to @mipmap/myicon.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...