java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$layout
引用multiDexEnabled = true android 4.x 及以下的手机不能运行,出现上述错误
引用multiDexEnabled 问题
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- ysn003 2015-11-16 07:17关注
这个问题我搜索了好久,在国内的搜索上找不到类似问题,所以自己提了一个。其实我已经解决了。
I faced the same issue and fixed it. It is issue with Dex Limit. Because the dex limit is reached, it creates two dex files. Lollipop knows how to read, preLollipop has no idea unless you tell it in application class.
就是dex限制问题,android5.x及以上的都知道,之前的版本要加一句话在 dependencies{}中android {
compileSdkVersion 21
buildToolsVersion "21.1.0"defaultConfig { ... minSdkVersion 14 targetSdkVersion 21 ... // Enabling multidex support. multiDexEnabled true } ...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}还要在Manifest.xml的application 标签中加入以下一句话:
<?xml version="1.0" encoding="utf-8"?>
package="com.example.android.multidex.myapplication">
...
android:name="android.support.multidex.MultiDexApplication">
...本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥100 set_link_state
- ¥15 虚幻5 UE美术毛发渲染
- ¥15 CVRP 图论 物流运输优化
- ¥15 Tableau online 嵌入ppt失败
- ¥100 支付宝网页转账系统不识别账号
- ¥15 基于单片机的靶位控制系统
- ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
- ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
- ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
- ¥15 手机接入宽带网线,如何释放宽带全部速度