我已经将android studio版本更新为3.1 - 在运行应用程序时导致错误

时间:2018-03-29 11:18:14

标签: android android-studio-3.0

最近我将Android Studio版本更新为3.1。更新后,我的项目没有构建,而是给我以下错误:

    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesAndResourcesWithProguardForStageDebug'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.RuntimeException: Job failed, see logs for details
    at com.android.build.gradle.internal.transforms.ProGuardTransform.transform(ProGuardTransform.java:196)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
    ... 32 more
    Caused by: java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:473)
    at proguard.ProGuard.initialize(ProGuard.java:233)
    at proguard.ProGuard.execute(ProGuard.java:98)
    at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:61)
    at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:253)
    at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:63)
    at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:173)
    at com.android.builder.tasks.Job.runTask(Job.java:47)
    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:282)
    ... 1 more

我不知道代码中的错误是什么,因为日志没有指向我的任何类文件。任何人都可以帮我解决这个问题吗?

更新项目级build.gradle文件后,我得到了不同的错误enter image description here

这是我的gradle文件

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

    buildscript {
        ext.kotlin_version = '1.2.31'
        repositories {
            google()
            jcenter()
            mavenCentral()
            maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
            maven { url 'https://maven.fabric.io/public' }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath 'com.google.gms:google-services:3.1.0'
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
            classpath 'io.fabric.tools:gradle:1.+'
            //classpath 'com.splunk:mint-gradle-android-plugin:5.2.2'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

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

    }

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

    ext {

        minSdkVersion = 16
        targetSdkVersion = 26

        compileSdkVersion = 27
        buildToolsVersion = "27.0.3"

        supportLibraryVersion = '27.1.0'
        playServicesVersion = '12.0.1'
        awsVersion = '2.3.4'
        OKHTTP_VERSION = '3.4.1'
        archRoomVersion = "1.0.0"
    }

这是我的应用级build.gradle文件

        buildscript {
        dependencies {
            // classpath 'io.fabric.tools:gradle:1.+'
            //classpath 'com.splunk:mint-gradle-android-plugin:5.2.2'
        }

        repositories {
            jcenter()
            mavenCentral()
            //maven { url 'https://maven.fabric.io/public' }
            maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
            //maven { url uri('mint-plugin-repo-5.2.2') }
        }
    }

    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
        //maven { url 'https://maven.fabric.io/public' }
        maven { url uri('mint-plugin-repo-5.2.2') }
    }


    apply plugin: 'com.android.application'
    //apply plugin: 'com.splunk.mint.gradle.android.plugin'
    apply plugin: 'io.fabric'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt'
    apply plugin: 'kotlin-android-extensions'


    androidExtensions {
        experimental = true
    }

    android {
        compileSdkVersion rootProject.compileSdkVersion

        defaultConfig {
            applicationId "xxxxxxxxxxxxxxxxx"
            minSdkVersion rootProject.minSdkVersion
            targetSdkVersion rootProject.targetSdkVersion
            multiDexEnabled true
            versionCode 41//3 //
            versionName "0.4.1"  //"1.0.2" //
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }


        productFlavors {

        }



        signingConfigs {
            release {

            }
        }



        buildTypes {

            debug {
                debuggable true
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            }

            release {
                signingConfig signingConfigs.release
                debuggable false
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
        }

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        lintOptions {
            abortOnError false
        }
        buildToolsVersion '27.0.3'
    }


    dependencies {
        implementation(name: 'nccsdk-0.0.9-stage', ext: 'aar')
        implementation 'com.android.support:multidex:1.0.3'
        implementation "com.android.support:support-v4:$supportLibraryVersion"
        implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
        implementation "com.android.support:design:$supportLibraryVersion"
        implementation "com.google.android.gms:play-services-gcm:$playServicesVersion"
        implementation "com.google.android.gms:play-services-location:$playServicesVersion"
        implementation "com.google.android.gms:play-services-maps:$playServicesVersion"
        implementation "com.google.firebase:firebase-database:$playServicesVersion"
        implementation "com.google.firebase:firebase-messaging:$playServicesVersion"
        implementation "com.google.firebase:firebase-storage:$playServicesVersion"
        implementation "com.google.firebase:firebase-core:$playServicesVersion"
        implementation "com.google.firebase:firebase-config:$playServicesVersion"
        implementation "com.google.firebase:firebase-auth:$playServicesVersion"
        implementation 'com.firebaseui:firebase-ui-database:2.1.0'
        implementation 'com.github.frangsierra:rx2firebase:1.1.3'
        implementation "com.android.support:cardview-v7:$supportLibraryVersion"
        implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
        implementation "com.android.support:animated-vector-drawable:$supportLibraryVersion"
        implementation 'com.jakewharton.timber:timber:4.6.0'
        implementation 'com.jakewharton:butterknife:8.8.1'
        kapt 'com.jakewharton:butterknife-compiler:8.8.1'
        implementation 'com.squareup.retrofit2:retrofit:2.3.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
        implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
        implementation 'javax.annotation:jsr250-api:1.0'
        implementation 'com.google.code.gson:gson:2.8.2'
        implementation 'com.google.dagger:dagger:2.11'
        kapt 'com.google.dagger:dagger-compiler:2.11'
        implementation 'javax.inject:javax.inject:1'
        //annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
        implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
        implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
        implementation 'com.android.support.constraint:constraint-layout:1.0.2'
        implementation 'com.karumi:dexter:2.3.1'
        implementation 'com.auth0.android:lock:1.14.1'
        implementation 'com.auth0.android:identity-core:1.14.1'
        implementation 'com.googlecode.libphonenumber:libphonenumber:7.0.4'
        //3rd Party Libraries
        implementation 'de.hdodenhof:circleimageview:2.2.0'
        implementation 'com.getkeepsafe.taptargetview:taptargetview:1.9.1'
        implementation group: 'com.zendesk', name: 'sdk', version: '1.11.0.1'
        implementation 'com.zopim.android:sdk:1.3.4.1'
        implementation 'com.github.bumptech.glide:glide:4.3.1'
        implementation 'com.nikhilpanju.recyclerviewenhanced:recyclerviewenhanced:1.1.0'
        implementation 'com.sothree.slidinguppanel:library:3.4.0'
        implementation 'com.github.barteksc:pdfium-android:1.4.0'
        implementation 'com.apptentive:apptentive-android:5.0.2'
        implementation 'com.vicmikhailau:MaskedEditText:2.0.3'
        implementation 'me.srodrigo:androidhintspinner:1.0.0'
        implementation 'ca.barrenechea.header-decor:header-decor:0.2.8'
        implementation 'com.github.HotBitmapGG:RingProgressBar:V1.2.2'
        implementation 'com.patloew.rxlocation:rxlocation:1.0.3'
        implementation 'org.apache.commons:commons-compress:1.12'

        implementation 'q.rorbin:badgeview:1.1.2'
        implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
            transitive = true
        }
        implementation('com.stripe:stripe-android:1.0.4@aar') {
            transitive = true;
        }
        implementation('io.branch.sdk.android:library:2.13.0@aar') {
            transitive = true;
        }
        androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })

        implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
        //implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jre8', version: '1.2.10'
        testImplementation 'junit:junit:4.12'
        implementation 'android.arch.persistence.room:runtime:' + rootProject.archRoomVersion;
        kapt "android.arch.persistence.room:compiler:" + rootProject.archRoomVersion;
        implementation 'android.arch.lifecycle:extensions:' + rootProject.archRoomVersion;
        implementation project(path: ':zxing')

        implementation 'com.splunk:mint-android-sdk:5.2.2'

        //SDK related libs
        implementation 'com.amazonaws:aws-android-sdk-kinesis:2.4.4'
        implementation 'com.amazonaws:aws-android-sdk-iot:2.4.4'
        implementation 'com.amazonaws:aws-android-sdk-s3:2.4.4'


    }

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

2 个答案:

答案 0 :(得分:4)

升级到3.1时,我将所有库更新到最新版本并遇到了与您相同的问题。

我回滚了build.gradle文件并且编译没有问题。 然后我一次更新了一个库,发现改造是导致问题的那个(2.4.0对我不起作用,但2.3.0有效)。

implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'

您也可以尝试使用回滚方法。

enter image description here

修改

您可以尝试将其添加到您的proguard文件中。 (它修复了我的错误,我可以毫无问题地更新到2.4.0)

-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn org.conscrypt.**

我注意到我的构建中有一些警告(见图) enter image description here

我去google“okhttp3.internal.platform.ConscryptPlatform:找不到引用的类org.conscrypt.OpenSSLProvider”

它引导我进行以下操作:https://github.com/square/okhttp/issues/3922

引导我到这个链接:https://github.com/square/okhttp/blob/5fe3cc2d089810032671d6135ad137af6f491d28/README.md#proguard(告诉我将上面的内容添加到proguard文件中)。

答案 1 :(得分:0)

在下面使用

-dontwarn okhttp3。** -dontwarn okio。** -dontwarn org.conscrypt。**

如果使用Java 8,请在下面添加

-dontwarn retrofit2.Platform $ Java8