如何解决gradle疑难杂症o resource found that matches the given name

《如何解决gradle疑难杂症o resource found that matches the given name》 image.png

Error:(5, 5) No resource found that matches the given name (at 'dialogCornerRadius' with value '?android:attr/dialogCornerRadius').
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process D:\Sdk\build-tools\27.0.1\aapt.exe with arguments {package -f --no-crunch -I D:\Sdk\platforms\android-26\android.jar -M \\?\D:\newdev\myproject\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\newdev\myproject\app\build\intermediates\res\merged\debug -m -J \\?\D:\newdev\myproject\app\build\generated\source\r\debug -F D:\newdev\myproject\app\build\intermediates\res\debug\resources-debug.ap_ -D \\?\D:\newdev\myproject\app\build\intermediates\multi-dex\debug\manifest_keep.txt --custom-package com.buyao.tv -0 apk -c en,zh --output-text-symbols \\?\D:\newdev\myproject\app\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process D:\Sdk\build-tools\27.0.1\aapt.exe with arguments {package -f --no-crunch -I D:\Sdk\platforms\android-26\android.jar -M \\?\D:\newdev\myproject\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\newdev\myproject\app\build\intermediates\res\merged\debug -m -J \\?\D:\newdev\myproject\app\build\generated\source\r\debug -F D:\newdev\myproject\app\build\intermediates\res\debug\resources-debug.ap_ -D \\?\D:\newdev\myproject\app\build\intermediates\multi-dex\debug\manifest_keep.txt --custom-package com.buyao.tv -0 apk -c en,zh --output-text-symbols \\?\D:\newdev\myproject\app\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'D:\Sdk\build-tools\27.0.1\aapt.exe'' finished with non-zero exit value 1
Error:org.gradle.tooling.BuildException: Failed to execute aapt
Error:com.android.ide.common.process.ProcessException: Failed to execute aapt
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process D:\Sdk\build-tools\27.0.1\aapt.exe with arguments {package -f --no-crunch -I D:\Sdk\platforms\android-26\android.jar -M \\?\D:\newdev\myproject\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\newdev\myproject\app\build\intermediates\res\merged\debug -m -J \\?\D:\newdev\myproject\app\build\generated\source\r\debug -F D:\newdev\myproject\app\build\intermediates\res\debug\resources-debug.ap_ -D \\?\D:\newdev\myproject\app\build\intermediates\multi-dex\debug\manifest_keep.txt --custom-package com.buyao.tv -0 apk -c en,zh --output-text-symbols \\?\D:\newdev\myproject\app\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process D:\Sdk\build-tools\27.0.1\aapt.exe with arguments {package -f --no-crunch -I D:\Sdk\platforms\android-26\android.jar -M \\?\D:\newdev\myproject\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\newdev\myproject\app\build\intermediates\res\merged\debug -m -J \\?\D:\newdev\myproject\app\build\generated\source\r\debug -F D:\newdev\myproject\app\build\intermediates\res\debug\resources-debug.ap_ -D \\?\D:\newdev\myproject\app\build\intermediates\multi-dex\debug\manifest_keep.txt --custom-package com.buyao.tv -0 apk -c en,zh --output-text-symbols \\?\D:\newdev\myproject\app\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'D:\Sdk\build-tools\27.0.1\aapt.exe'' finished with non-zero exit value 1

这是android studio 编译的时候自动导入的,通常是build版本达到了26 不是28,而系统自动导入了28的包,
解决方法我目前只想到了这个

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")
                    && !requested.name.startsWith("exifinterface")) {
                details.useVersion '26.0.1'
                //不设置24.2.1但是设置到了25就找不到布局,全部不管好像又冲突设置24.2.1 那么 要么冲突 要么       java.lang.NoSuchFieldError: No field notification_template_lines of type
            }
        }
    }
}

感觉这是一个bug吧,明明没有任何地方使用28,而且我暴力删除了的自动生成的,他还是会下载,

D:\newdev\myproject\app\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)
<a href="openFile:D:/newdev/myproject/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)">Show Details</a>
Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)
<a href="openFile:D:/newdev/myproject/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugAndroidTest/compileClasspath&#39;: Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)">Show Details</a>
Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)
<a href="openFile:D:/newdev/myproject/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debugUnitTest/compileClasspath&#39;: Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)">Show Details</a>
Error:Unable to resolve dependency for ':app@release/compileClasspath': Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)
<a href="openFile:D:/newdev/myproject/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@release/compileClasspath&#39;: Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)">Show Details</a>
Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)
<a href="openFile:D:/newdev/myproject/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@releaseUnitTest/compileClasspath&#39;: Could not download appcompat-v7.aar (com.android.support:appcompat-v7:28.0.0-alpha1)">Show Details</a>
Gradle Sync Issues
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/app/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/IMKit/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/IMLib/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/appx/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/magicindicator/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/isoprogressbar/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/multi-image-selector/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/live_player/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/multicallpushstream/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/pulltorefresh_library/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/musicservice/build.gradle">Open File</a>
Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.1) for Android Gradle Plugin 3.1.0-alpha09.
Android SDK Build Tools 27.0.1 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
<a href="fix.build.tools.version">Update Build Tools version and sync project</a><br><a href="openFile:D:/newdev/myproject/sharesdk/build.gradle">Open File</a>
D:\newdev\myproject\IMKit\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\IMLib\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\appx\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
D:\newdev\myproject\magicindicator\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\isoprogressbar\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\multi-image-selector\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\live_player\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\multicallpushstream\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\pulltorefresh_library\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
D:\newdev\myproject\musicservice\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
D:\newdev\myproject\sharesdk\build.gradle
Warning:AAPT is deprecated and support for it will be soon removed. Remove the 'android.enableAapt2=false' flag to enable AAPT2.
    原文作者:情随事迁666
    原文地址: https://www.jianshu.com/p/0c4835d19d6a
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞