AndroidStudio升级gradle插件版本到2.3.1异常

AndroidStudio升级gradle插件版本到2.3.1之后不能运行了,提示MultiDex找不到,由此引发了很多问题。

开始升级

插件版本升级到2.3.1,配置project / build.gradle

classpath "com.android.tools.build:gradle:2.3.1"

gradle版本升级到3.3,配置project / gradle / gradle-wrapper.properties

#Sun Mar 05 00:36:45 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

分包引起的问题

配置分包

defaultConfig {
        multiDexEnabled true
    }

依赖添加
compile 'com.android.support:multidex:1.0.1'

小米的问题

一切都ok之后出现了新的问题,Failed to establish session
然后无法安装应用,在github上面找到了回答,瞻仰一下。

最后总结就是要把开发者模式的MIUI优化选项给关闭掉,不然安装不了。

之前还有一个开启允许Usb安装的选项,不打开的话也无法安装应用,总之小米手机特别一点。

Works !
for those who suffer from this:

enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.  

Go back to Settings, Additional settings, Developer options and enable USB Debugging.

Connect your phone to your PC/Mac and on the phone authorize your computer

go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted

Try it now :)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值