【问题标题】:Upgrade Gradle version and lib upgrade - failed升级 Gradle 版本和 lib 升级 - 失败
【发布时间】:2018-10-16 08:13:23
【问题描述】:
UPDATED , Now Error also changed

在我有 compileSdkVersion 25 和相关的支持库之前,

现在我将它更新到 28,它显示如下错误:

org.gradle.api.tasks.TaskExecutionException:任务执行失败 ':androidcommonlibrary:compileDebugJavaWithJavac'。在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) 在 org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) 在 org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) 在 org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)

应用级 build.gradle 文件:

apply plugin: 'com.android.application'

apply plugin: 'io.fabric'
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.vosap"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 8//increase when upload to play store
        versionName "1.7"//increase when upload to play store
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    ///////

    api project(':androidcommonlibrary')

    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'org.parceler:parceler-api:1.1.6'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    implementation 'com.android.support:customtabs:28.0.0'

    implementation 'com.android.support:palette-v7:28.0.0'


    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.facebook.android:facebook-android-sdk:4.37.0'

    //firebase
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-messaging:17.3.3'

    implementation 'com.google.android.gms:play-services-plus:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.0'

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true
    }

    // https://mvnrepository.com/artifact/com.github.arturogutierrez/badges
    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
    //for auto scroll viewPager
    implementation 'com.github.demoNo:AutoScrollViewPager:v1.0.2'

    //////

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    annotationProcessor 'org.parceler:parceler:1.1.6'
}
apply plugin: 'com.google.gms.google-services'

项目级 build.gradle 文件:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
        classpath 'io.fabric.tools:gradle:1.26.1'

        //todo remove
        //classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

    }
}


allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

还有一个库的 build.gradle :

apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
        jumboMode = true
    }
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    lintOptions {
        disable 'InvalidPackage'
    }
    buildToolsVersion '28.0.3'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //    compile 'com.android.support:appcompat-v7:25.0.0'
    api 'com.android.support:appcompat-v7:28.0.0'
    //implementation 'com.android.support:appcompat-v7:28.0.0'

    /*api 'com.android.support:support-compat:28.0.0'
    api 'com.android.support:support-fragment:28.0.0'
    api 'com.android.support:support-core-ui:28.0.0'
    api 'com.android.support:support-core-utils:28.0.0'
    api 'com.android.support:support-media-compat:28.0.0'
    api 'com.android.support:multidex:1.0.3'*/


    api 'com.android.support:design:28.0.0'
    api 'com.github.bumptech.glide:glide:4.7.1'

    // google play service
    api 'com.google.android.gms:play-services-maps:16.0.0'
    api 'com.google.android.gms:play-services-location:16.0.0'
    api 'com.google.android.gms:play-services-places:16.0.0'

    api 'com.squareup.okhttp3:okhttp:3.11.0'

    api 'com.intuit.sdp:sdp-android:1.0.5'

}

我已经厌倦了解决它,但没有解决方案。

【问题讨论】:

  • 专门添加支持库,实现 'com.android.support:support:28.0.0' [不确定,请检查确切的库]
  • @RishabhDugar,我已将它添加到库中,并且该库已扩展到我的应用程序模块。所以不确定是否需要再次添加?
  • @RishabhDugar,我添加了 -- api 'com.android.support:support-compat:28.0.0' -- 还是一样的错误
  • 你能把/home/admin1/Project_WorkSpace/BV CurrentProject/DemoApp/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml的第186和188行贴出来吗?
  • @IzabelaOrlowska,现在我的错误已更改,我已更新 que 中的错误

标签: android android-studio gradle compiler-errors


【解决方案1】:

下面试试

compileSdkVersion 27
buildToolsVersion '27.0.3'
targetSdkVersion 27

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'

implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-fitness:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
implementation 'com.google.firebase:firebase-core:16.0.4'

在项目构建 gradle 中

classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'

在属性中

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

【讨论】:

  • 谢谢@Pavya,但我不能为 28 提供支持吗?
猜你喜欢
  • 1970-01-01
  • 2018-01-19
  • 1970-01-01
  • 2018-12-17
  • 2022-11-11
  • 1970-01-01
  • 1970-01-01
  • 2020-03-13
  • 2018-12-30
相关资源
最近更新 更多