没有 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' 

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

请您参考如下方法:

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


评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!