在'android'包中找不到属性'roundIcon'的资源标识符

And*_*iSG 27 xml android

我正在尝试编译我的项目,但是有一些错误

Android manifest.xml

 <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
Run Code Online (Sandbox Code Playgroud)

我已经尝试重建项目或与gradle同步,但它不适合我.

我的依赖

compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':circleimageview-2.0.0-sources')
Run Code Online (Sandbox Code Playgroud)

如何解决这个错误?我是Android Studio的新手.

Mic*_*odd 52

roundIconAndroid Nougat 7.1(API级别25)首次引入的属性,因此根据您要定位的设备类型,您有两个可用选项:

  • 如果你明确构建应用程序的Android 7.1或以上,确保minSdkVersiontargetSdkVersion设置为应用程式的25 build.gradle:

defaultConfig {
    minSdkVersion 25
    targetSdkVersion 25
}
Run Code Online (Sandbox Code Playgroud)
  • 或者,如果您要定位较旧的API级别,则需要android:roundIcon从清单中删除并仅使用android:icon.

  • 我相信这是android studio的一个bug,我专门创建了用API 21编译的项目,但是`android:roundIcon`属性仍然添加到`AndroidManifest.xml` (8认同)
  • Android studio即使在从清单中删除它之后也会继续添加roundIcon,从而导致构建失败.如何使用compileSdkVersion 23来解决这个问题? (3认同)
  • Android 7.1仍然是N(Nougat).Android O是8.0. (2认同)

小智 7

android:roundIcon从我的清单中删除了,但是当使用API​​ 24编译我的项目时,该android:roundIcon属性仍然被添加到AndroidManifest.xml.

为了解决我的问题,我必须将我的API更新到版本25并设置comileSdkversion25.