Android(安卓)方法数超过64k限制的解决办法
16lz
2021-12-04
android { compileSdkVersion COMPILE_SDK_VERSION as int buildToolsVersion BUILD_TOOLS_VERSION defaultConfig { applicationId "com.x.xxx" minSdkVersion MIN_SDK_VERSION as int targetSdkVersion TARGET_SDK_VERSION as int versionCode 4 versionName "1.0.3" multiDexEnabled true } ... sourceSets { main { jniLibs.srcDirs = ['libs'] } } dexOptions{ javaMaxHeapSize "2g" }}
1.在app的build.gradle文件中添加
multiDexEnabled truedexOptions{ javaMaxHeapSize "2g" }
2.在依赖中添加multidex
dependencies { ... compile 'com.android.support:multidex:1.0.0' }
3.重写Application子类的方法
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }
参考:
http://www.itnose.net/detail/6168594.html
更多相关文章
- Android中实现Launcher功能之一 ----- 添加快捷方式
- Android(安卓)studio SDK6.0 不支持HttpClient解决办法
- 76 Android(安卓)BroadcastReceiver简单使用
- android代码混淆后gson无法解析问题
- Android为图片添加水印文字
- Android(安卓)onClick事件三种实现方法
- Android:缩小图片尺寸,并添加水印
- Android(安卓): upload Image using MultiPartEntityBuilder
- Android(安卓)添加书签(二)