Error:com.android.dex.DexException: Multiple dex files define Landroid/suppo

错误环境:

       

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

       早上打开AS,神奇报错

       Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > java.

       Error:com.android.dex.DexException: Multiple dex files define Landroid/suppo

      还有这种-->

       ':app:transformDexArchiveWithE 

      为什么不能提出来完整的报错呢,因为这个问题已经解决。

      

错误解决方法:

       网络上各种提示,

       有MultiDex的提示,让你继承application重写分包方法的

 @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

        有在app下的build.gradle文件中添加分包声明的:

compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.salesmanservice"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true//添加这句
        //        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    //添加下面这句
    dexOptions {
        javaMaxHeapSize "4g"
    }

       但是,作为常年伏案开发的你们来说,这些你们不知道?

       所以,更换sdk得版本: 27

    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.salesmanservice"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

       然后就是不停的clean, rebuild  重复,重复,再重复……

       温馨提示:在陪UI妹子聊天的同事去clean有效果加成……

    

       为什么更改版本为27之后问题就不存在,特别是对databinding的引用问题上,有待研究,

如果您知道,请告知:

      QQ群: 88627109

      珍重

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值