【问题标题】:Error converting bytecode to dex with ProGuard使用 ProGuard 将字节码转换为 dex 时出错
【发布时间】:2018-02-27 12:41:01
【问题描述】:

得到这个错误没有 multidex:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

启用multidex

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.multidex.ClassReferenceListBuilder with arguments {C:\Users\pah-to-app\app\build\intermediates\multi-dex\debug\componentClasses.jar C:\Users\pah-to-app\app\build\intermediates\transforms\proguard\debug\jars\3\1f\main.jar}

这是我的gradle 文件:

   apply plugin: 'com.android.application'

    android {
        compileSdkVersion 27
        buildToolsVersion "27.0.2"
        defaultConfig {
            applicationId "AAA.AAAAAAA.AAAA"
            minSdkVersion 17
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath false
                }
            }
            vectorDrawables.useSupportLibrary = true

        }
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            debug {
                minifyEnabled true
                shrinkResources true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'commons-io:commons-io:2.4'
        compile 'com.android.volley:volley:1.0.0'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.facebook.android:facebook-login:4.30.0'
        compile 'com.google.android.gms:play-services-auth:11.8.0'
        compile 'com.google.android.gms:play-services-ads:11.8.0'
        compile 'com.google.firebase:firebase-core:11.8.0'
        compile 'com.google.firebase:firebase-messaging:11.8.0'
        //compile 'com.android.support:support-v4:27.0.2'
        compile 'com.android.support:support-vector-drawable:27.0.2'
        compile 'com.android.support:design:27.0.2'
        compile 'com.android.support:appcompat-v7:27.0.2'
        compile 'de.hdodenhof:circleimageview:2.2.0'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
        testCompile 'junit:junit:4.12'
    }
apply plugin: 'com.google.gms.google-services'

期待您的有用建议来解决此问题。谢谢。

【问题讨论】:

    标签: java android gradle proguard


    【解决方案1】:

    您的项目中有一些 .jar 文件使用旧版本的google play services

    【讨论】:

    • 这是我的dexguard 字符串混淆library 创建的问题。我仍然标记为已接受的答案,因为它是 aar 格式。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-10
    • 2017-02-27
    • 1970-01-01
    • 1970-01-01
    • 2016-09-02
    相关资源
    最近更新 更多