
Conversion to Dalvik format failed:Unable toexecute dex: method ID not in [0, 0xffff]: 65536
假设你的应用出现这样的问题。那恭喜你,你的app内容已经许多了,也恭喜你遇到了这么一个坑爹的问题这个问题在许多地方都有解释假设解决,可是都很麻烦。我给个比較方便的
此处解说用的是android studio
首先配置build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1" defaultConfig {
...
minSdkVersion 14
targetSdkVersion 23
... // Enabling multidex support.
multiDexEnabled true
} dexOptions {
javaMaxHeapSize "4g"
}
...
} dependencies {
compile 'com.android.support:multidex:1.0.0'
}
最后在application或者是你的AppContext
中增加初始化操作就能够了,也能够在onCreate里面运行。要放在super.onCreate(); 的前面。
<pre style="overflow: auto; margin-top: 20px; margin-bottom: 20px; padding: 15px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><span style="word-break: break-all; border-radius: 4px; background-image: none; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">public class AppContext extends Application { @Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
} @Override
public void onCreate() {
super.onCreate();
}
}</span>