升级Gradle版本和lib升级-失败

时间:2018-10-16 08:13:23

标签: android android-studio gradle compiler-errors

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'

}

我很累要解决,但没有解决办法。

1 个答案:

答案 0 :(得分:0)

尝试以下

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'

在Project build 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