android - 构建版本更改后无法获取构建

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

我有一个遗留项目,它有几乎大量的依赖项,我无法从 Gradle 获得构建。

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

1

2

我试过向后的 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'

最佳答案

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

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

关于android - 构建版本更改后无法获取构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48865427/

相关文章:

android - 在 libGDX 中,我可以针对低于框架要求的 API 级别吗?

android - 谷歌日历库禁用以前的日期

android - 如何为pdf文件分页 curl

Android Studio 导致 Windows 8.1 崩溃

java - 如何在 Eclipse 和 Android Studio 之间共享 Java 源代码?

java - findViewById() 可能会为 HomeFragment.java 中的 getView() 产生 NullPointerException

java - 为什么 Eclipse Android IDE 在使用少量后变得如此缓慢和滞后?

java - 如何使 Observable 在 1 秒的时间间隔后发出字符

android - Android 中带有 NDK 的 OpenGL ES 2 的一些教程?

c# - 在 Visual Studio 2012 中使用 DirectX