在构建版本更改后无法获取构建

时间:2018-02-19 11:40:43

标签: android android-studio sdk android-gradle build.gradle

我有一个遗留项目,其中包含大量依赖项,我无法从Gradle获得构建。

这是我得到的错误(为此我搜索了SOF并且得出了这些答案,但没有一个对我有用:

1

2

我已经尝试过backwarding buildTools版本和sdk版本。没有任何效果。

以下是我得到的错误:

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :sidemenulibrary:generateDebugSources, :sidemenulibrary:generateDebugAndroidTestSources, :sidemenulibrary:mockableAndroidJar]
C:\Users\Farzin\.gradle\caches\transforms-1\files-1.1\play-services-auth-11.8.0.aar\816b583fabfaa884d4138f99d0ffc734\res\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
C:\Users\Farzin\.gradle\caches\transforms-1\files-1.1\play-services-auth-11.8.0.aar\816b583fabfaa884d4138f99d0ffc734\res\drawable-watch-v20\common_google_signin_btn_text_disabled.xml
Error:(16, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_disabled_color_18').
C:\Users\Farzin\.gradle\caches\transforms-1\files-1.1\play-services-auth-11.8.0.aar\816b583fabfaa884d4138f99d0ffc734\res\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\merged\debug\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\merged\debug\drawable-watch-v20\common_google_signin_btn_text_disabled.xml
Error:(16, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_disabled_color_18').
C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\merged\debug\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\SDK\sdk_1\build-tools\27.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\SDK\sdk_1\platforms\android-27\android.jar -M \\?\C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\merged\debug -m -J \\?\C:\Users\Farzin\Desktop\Helsa\android\app\build\generated\source\r\debug -F C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.parsdigit.helsa -0 apk --output-text-symbols \\?\C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process C:\SDK\sdk_1\build-tools\27.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\SDK\sdk_1\platforms\android-27\android.jar -M \\?\C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\merged\debug -m -J \\?\C:\Users\Farzin\Desktop\Helsa\android\app\build\generated\source\r\debug -F C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.parsdigit.helsa -0 apk --output-text-symbols \\?\C:\Users\Farzin\Desktop\Helsa\android\app\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'C:\SDK\sdk_1\build-tools\27.0.2\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 31s
Information:10 errors
Information:0 warnings
Information:See complete output in console

enter image description here

我也尝试按照SOF上的一些帖子的建议更改播放服务版本并得到这些错误:

Information:Gradle tasks [:sidemenulibrary:generateDebugSources, :sidemenulibrary:generateDebugAndroidTestSources, :sidemenulibrary:mockableAndroidJar, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
C:\Users\Farzin\.gradle\caches\transforms-1\files-1.1\play-services-auth-11.8.0.aar\816b583fabfaa884d4138f99d0ffc734\res\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
C:\Users\Farzin\.gradle\caches\transforms-1\files-1.1\play-services-auth-11.8.0.aar\816b583fabfaa884d4138f99d0ffc734\res\drawable-watch-v20\common_google_signin_btn_text_disabled.xml
Error:(16, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_disabled_color_18').
C:\Users\Farzin\.gradle\caches\transforms-1\files-1.1\play-services-auth-11.8.0.aar\816b583fabfaa884d4138f99d0ffc734\res\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\merged\androidTest\debug\drawable-watch-v20\common_google_signin_btn_text_dark_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\merged\androidTest\debug\drawable-watch-v20\common_google_signin_btn_text_disabled.xml
Error:(16, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_disabled_color_18').
C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\merged\androidTest\debug\drawable-watch-v20\common_google_signin_btn_text_light_normal.xml
Error:(9, 30) No resource found that matches the given name (at 'src' with value '@drawable/googleg_standard_color_18').
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\SDK\sdk_1\build-tools\27.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\SDK\sdk_1\platforms\android-27\android.jar -M \\?\C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\manifest\androidTest\debug\AndroidManifest.xml -S C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\merged\androidTest\debug -m -J \\?\C:\Users\Farzin\Desktop\MyProject\android\app\build\generated\source\r\androidTest\debug -F C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\androidTest\debug\resources-debugAndroidTest.ap_ -0 apk --output-text-symbols \\?\C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\symbols\androidTest\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process C:\SDK\sdk_1\build-tools\27.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\SDK\sdk_1\platforms\android-27\android.jar -M \\?\C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\manifest\androidTest\debug\AndroidManifest.xml -S C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\merged\androidTest\debug -m -J \\?\C:\Users\Farzin\Desktop\MyProject\android\app\build\generated\source\r\androidTest\debug -F C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\res\androidTest\debug\resources-debugAndroidTest.ap_ -0 apk --output-text-symbols \\?\C:\Users\Farzin\Desktop\MyProject\android\app\build\intermediates\symbols\androidTest\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'C:\SDK\sdk_1\build-tools\27.0.2\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':app:processDebugAndroidTestResources'.
> Failed to execute aapt
Information:BUILD FAILED in 18s
Information:10 errors
Information:0 warnings
Information:See complete output in console

这是我的Gradle.app:

apply plugin: 'com.android.application'

android
        {
            compileSdkVersion 27
            buildToolsVersion '27.0.2'
            defaultConfig
                    {
                        applicationId "com.parsdigit.helsa"
                        manifestPlaceholders = [onesignal_app_id: "4af7b2c1-a1a8-4b4a-ade3-d65289b38267",
                                                // Project number pulled from dashboard, local value is ignored.
                                                onesignal_google_project_number: "REMOTE"]
                        minSdkVersion 19
                        targetSdkVersion 27
                        versionCode 1
                        versionName "1.0"
                        vectorDrawables.useSupportLibrary = true
                        multiDexEnabled true
                    }
            buildTypes
                    {
                        release
                                {
                                    minifyEnabled true
                                    shrinkResources true
                                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                                }
                    }

            packagingOptions
                    {
                        exclude 'META-INF/DEPENDENCIES'
                        exclude 'META-INF/LICENSE'
                        exclude 'META-INF/LICENSE.txt'
                        exclude 'META-INF/license.txt'
                        exclude 'META-INF/NOTICE'
                        exclude 'META-INF/NOTICE.txt'
                        exclude 'META-INF/notice.txt'
                        exclude 'META-INF/ASL2.0'
                    }

            lintOptions
                    {
                        checkReleaseBuilds false
                    }
            dexOptions
            {
                preDexLibraries = false
            }
        }

dependencies
        {
            implementation 'com.android.support.constraint:constraint-layout:1.0.2'
            compile fileTree(dir: 'libs', include: ['*.jar'])
            compile('com.squareup.okhttp3:okhttp:3.+')
            compile 'com.android.support:multidex:1.0.2'
            compile 'com.android.support:design:27.0.2'
            compile 'com.android.support:appcompat-v7:27.+'
            compile 'com.google.android.gms:play-services:11.8.0'
            compile 'com.google.android.gms:play-services-location:11.8.0'
            compile 'com.android.support:recyclerview-v7:27.+'
            compile 'com.google.firebase:firebase-core:11.8.0'
            compile 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
            compile 'org.apache.httpcomponents:httpclient:4.5.4'
            compile 'com.google.maps.android:android-maps-utils:0.4.3'
            compile 'com.google.code.gson:gson:2.8.2'
            compile 'uk.co.chrisjenx:calligraphy:2.2.0'
            compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
            compile 'gun0912.ted:tedpermission:1.0.3'
            compile 'com.kennyc:snackbar:2.5'
            compile 'me.itangqi.waveloadingview:library:0.3.5'
            compile 'com.daimajia.androidanimations:library:2.3@aar'
            compile 'com.fujiyuu75:sequent:0.2.1'
            compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
            compile 'pl.charmas.android:android-reactive-location:0.10@aar'
            compile 'io.reactivex:rxjava:1.2.0'
            compile 'me.zhanghai.android.materialratingbar:library:1.2.0'
            compile 'cn.lightsky.infiniteindicator:library:1.2.2'
            compile 'com.squareup.picasso:picasso:2.+'
            compile 'com.nineoldandroids:library:2.4.0'
            compile 'de.hdodenhof:circleimageview:2.2.0'
            compile 'com.github.wooplr:Spotlight:1.2.3'
            compile 'com.wang.avi:library:2.1.3'
            compile 'com.caverock:androidsvg:1.2.1'
            compile 'com.github.bumptech.glide:glide:3.8.0'
            compile project(':sidemenulibrary');
            compile ('com.github.ozodrukh:CircularReveal:1.1.1@aar')
            {
                transitive = true;
            }
            compile 'org.greenrobot:eventbus:3.0.0'
            compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
            compile 'com.nex3z:notification-badge:0.3.0'
            compile 'com.github.Shashank02051997:FancyGifDialog-Android:1.1'
            compile 'br.com.simplepass:loading-button-android:1.+'
            compile 'com.github.GrenderG:Toasty:1.2.8'
            compile 'com.github.blennerSilva:AwesomeDialog:2.0.5'
            compile 'me.relex:circleindicator:1.2.2@aar'
            compile 'com.airbnb.android:lottie:2.2.5'
            compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
            compile 'com.github.RobertApikyan:SegmentedControl:release_1.0.1'
            compile 'com.github.skydoves:powermenu:2.0.1'
            compile 'com.otaliastudios:cameraview:1.4.1'
            compile 'com.mindorks:placeholderview:0.7.2'
            compile 'com.google.code.gson:gson:2.7'
            compile 'com.github.Mostafa-MA-Saleh:EditCredit:1.5.0'
        }

apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:3)

实际上您需要删除所有Gradle缓存并通过Android Studio重新构建它。

还建议删除Android Studio并以管理员身份运行新的Android Studio。

答案 1 :(得分:0)

尝试设置buildToolsVersion '27.0.3' - 我遇到了同样的问题,它对我有用。