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

标签 android android-studio gradle compiler-errors

UPDATED , Now Error also changed

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

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

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':androidcommonlibrary:compileDebugJavaWithJavac'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) at 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'

}

我很累要解决,但没有解决方案。

最佳答案

尝试下面

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

关于android - 升级Gradle版本和lib升级-失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52830839/

相关文章:

java - 在 XML 中的 ListView 上方添加 header

java - 房间: Warnings: Parameter is never used/Variable is never used

android - 无法从 Android Studio 构建

java - 如何正确创建 Gradle 任务?

android - Gradle 构建未执行,因为找不到 cache.properties

android - 在手指手势屏幕上的任何位置移动旋转的图像

android - 如何在 Android 4.4 中查找数据库路径(API 级别 : 19)?

android - 使用 native 代码进入会导致 Android Studio 中出现垃圾

android - 错误 : Cannot fit requested classes in a single dex file (# methods: 67593 > 65536)

java - 如何将Spring Boot应用程序部署到AWS Elastic Beanstalk?