在Android Studio 3中同步项目时出现Gradle错误

时间:2017-11-25 07:57:17

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

任何时候我在android studio 3中创建项目我都有与错误同步的问题。

enter image description here 消息Gradle Build:

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 module config:

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'
    }

1 个答案:

答案 0 :(得分:3)

与此answer相关的

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

  • 如果您正在构建专门针对Android O的应用,请确保应用minSdkVersion中的targetSdkVersionbuild.gradle设置为25:
defaultConfig {
    minSdkVersion 25
    targetSdkVersion 25
}
  • 或者,如果您要定位较旧的API级别,则需要从清单中删除android:roundIcon,并仅使用android:icon