首页 > 解决方案 > 运行发布构建时出现异常'处理任务java.io.IOException时出现异常:'如何解决这个问题?

问题描述

我正在使用谷歌云语音到文本 api,如果我得到这样的发布构建抛出异常Exception while processing task java.io.IOException:

例外

Warning: Exception while processing task java.io.IOException: Can't write [D:\Workspace\Projects\t-wise\app\build\intermediates\transforms\proguard\release\0.jar] (Can't read [D:\Workspace\Projects\t-wise\app\build\intermediates\javac\release\compileReleaseJavaWithJavac\classes(;;;;;;;**.class)] (Can't read [com] (Can't read [google] (Can't read [protobuf] (Can't read [Any$1.class] (Duplicate jar entry [com/google/f/f$1.class]))))))

我的毕业档案

apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'

ext {
  grpcVersion = '1.12.0'
}
android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.xxx.xxx"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 1
    versionName "1.1"
    flavorDimensions "default"
    multiDexEnabled true

    javaCompileOptions {
        annotationProcessorOptions {
            includeCompileClasspath true
        }
    }
}
buildTypes {

    debug {
        minifyEnabled false
        multiDexEnabled true
    }
    release {
        minifyEnabled true
        shrinkResources false
        debuggable false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/io.netty.versions.properties'
    exclude 'META-INF/INDEX.LIST'
    exclude 'META-INF/com.google.f'
}

lintOptions {
    disable 'InvalidPackage'
    checkReleaseBuilds false
}

dexOptions {
    javaMaxHeapSize "Xg"
}

//
  /*  productFlavors {
    dev {
        // Minimum version with platform multi-dex support
        minSdkVersion 21
    }
    prod {
        // Minimum version that can run gRPC (TLS extension)
        minSdkVersion 16
    }
}*/
protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.3.0'
    }
    plugins {
        javalite {
            artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
        }
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.plugins {
                javalite {}
                grpc {
                    // Options added to --grpc_out
                    option 'lite'
                }
            }
        }
    }
}

//
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

implementation 'com.google.cloud:google-cloud-translate:1.65.0'

// add these dependencies for the speech client
// gRPC
implementation 'io.grpc:grpc-okhttp:1.12.0'
implementation 'io.grpc:grpc-stub:1.12.0'
implementation 'javax.annotation:javax.annotation-api:1.2'
protobuf 'com.google.protobuf:protobuf-java:3.3.1'

implementation 'com.google.cloud:google-cloud-speech:0.53.0-alpha'

implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'

implementation 'com.android.support:multidex:1.0.3'
implementation 'org.conscrypt:conscrypt-android:2.1.0'
}

如何解决这个错误,请任何人给我一个解决方案。

提前谢谢...

标签: androidwarningsreleaseioexceptionrelease-builds

解决方案


推荐阅读