【问题标题】:Gradle error when sync project in Android Studio 3在 Android Studio 3 中同步项目时出现 Gradle 错误
【发布时间】:2017-11-25 07:57:16
【问题描述】:

每当我在 android studio 3 中创建项目时,我都会遇到 gradle 同步错误的问题。

消息 Gradle 构建:

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
/Applications/Desktop/AndroidProjects/RealmProject/app/build/intermediates/manifests/full/debug/AndroidManifest.xml
Error:(11) error: attribute 'android:roundIcon' not found.
Error:(11) attribute 'android:roundIcon' not found.
Error:failed processing manifest.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 23s
Information:7 errors
Information:0 warnings
Information:See complete output in console

app.gradle 模块配置:

android {
    compileSdkVersion 24
    defaultConfig {
        applicationId "com.example.mohammad.realmproject"
        minSdkVersion 17
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:24.0.0'
        testImplementation 'junit:junit:4.12'
    }

【问题讨论】:

  • 问题出在这里:找不到属性'android:roundIcon'。

标签: android android-gradle-plugin android-studio-3.0


【解决方案1】:

answer 相关 => roundIconfirst introduced for Android O(8.0,API 级别 25)的属性,因此您有两个可用选项根据您定位的设备类型:

  • 如果您要专门为 Android O 构建应用,请确保在应用的 build.gradle 中将 minSdkVersiontargetSdkVersion 设置为 25:

defaultConfig {
    minSdkVersion 25
    targetSdkVersion 25
}

  • 或者,如果您想针对较旧的 API 级别,则需要从清单中删除 android:roundIcon 并仅使用 android:icon

【讨论】:

  • API 25 是 Nougat 维护版本 1,Android 7.1。
猜你喜欢
  • 2015-06-17
  • 1970-01-01
  • 1970-01-01
  • 2014-01-30
  • 2015-06-17
  • 2020-01-19
  • 2016-08-04
  • 1970-01-01
相关资源
最近更新 更多