android - 尝试在Android Studio中创建新项目时发生Gradle错误

标签 android android-studio gradle

每当我在AndroidStudio中创建新项目时,都会收到Gradle错误?我已经在Mac上安装并重新安装了android studio,但该错误仍然出现并出现了相同的错误。
下面是我从Logcat看到的错误。

/Users/yodgorbekkomilov/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/d531dbb8e7f408824a92fa6cc86908a2/res/layout/select_dialog_item_material.xml

Error:(31, 27) No resource found that matches the given name (at 'paddingStart' with value '?attr/listPreferredItemPaddingStart'). Error:(32, 25) No resource found that matches the given name (at 'paddingEnd' with value '?attr/listPreferredItemPaddingEnd'). /Users/yodgorbekkomilov/Desktop/MyApplication2/app/build/intermediates/res/merged/debug/layout/select_dialog_item_material.xml

Error:(31, 27) No resource found that matches the given name (at 'paddingStart' with value '?attr/listPreferredItemPaddingStart'). Error:(32, 25) No resource found that matches the given name (at 'paddingEnd' with value '?attr/listPreferredItemPaddingEnd').

Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process /Users/yodgorbekkomilov/Library/Android/sdk/build-tools/26.0.2/aapt with arguments {package -f --no-crunch -I /Users/yodgorbekkomilov/Library/Android/sdk/platforms/android-26/android.jar -M /Users/yodgorbekkomilov/Desktop/MyApplication2/app/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/yodgorbekkomilov/Desktop/MyApplication2/app/build/intermediates/res/merged/debug -m -J /Users/yodgorbekkomilov/Desktop/MyApplication2/app/build/generated/source/r/debug -F /Users/yodgorbekkomilov/Desktop/MyApplication2/app/build/intermediates/res/debug/resources-debug.ap_ --custom-package com.example.yodgorbekkomilov.myapplication -0 apk --output-text-symbols /Users/yodgorbekkomilov/Desktop/MyApplication2/app/build/intermediates/symbols/debug --no-version-vectors}

Error:org.gradle.process.internal.ExecException: Process 'command '/Users/yodgorbekkomilov/Library/Android/sdk/build-tools/26.0.2/aapt'' finished with non-zero exit value 1 Error:Execution failed for task ':app:processDebugResources'.

Failed to execute aapt


below my buld.gradle file

android {
    compileSdkVersion 26

    defaultConfig {
        applicationId "com.example.yodgorbekkomilov.myapplication"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

最佳答案

Error:(31, 27) No resource found that matches the given name (at 'paddingStart' with value '?attr/listPreferredItemPaddingStart'). Error:(32, 25) No resource found that matches the given name (at 'paddingEnd' with value '?attr/listPreferredItemPaddingEnd').



看来?attr/listPreferredItemPaddingEnd已从API 26中删除。请尝试为您的paddingStart文件中的paddingEndselect_dialog_item_material.xml属性使用其他值。

关于android - 尝试在Android Studio中创建新项目时发生Gradle错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49352705/

相关文章:

linux - Android Studio 看不到 Chrome 设备

gradle在发布任务期间不执行构建

android - Build.gradle 文件损坏

android - Android Studio-想要1 APK,但无法正常工作

javascript - 如何在 React Native 中从 PHP 获取 json

android - 指定调用此应用的包名

java - android studio 自动完成 : how to display constructors with parameters

android - Android Studio 中缺少 com.android.tools.build.gradle4.1

android - ImageView限制拖放和缩小屏幕

java - 如何使用android在textview中显示输出?