![](/img/trans.png)
[英]Execution failed for task ':app:processDebugResources' in Flutter project
[英]Execution failed for task ':Project:processDebugResources
当您的应用程序超出65k方法限制时,可能会发生这种情况。
要使用超过65k的方法来构建应用,您必须添加多dex支持。 将它们添加到您的应用gradle文件中。
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14 // Multi Dex not supported below 14
targetSdkVersion 23
multiDexEnabled true // To Enable Multi Dex
}
dexOptions {
preDexLibraries = false /*Include these three statements to build app quickly (at least faster than before :p) */
javaMaxHeapSize "4g" // To avoid GC Limit Exception
jumboMode = true // To avoid GC Limit Exception
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
/* MultiDex - method count exceeds 65k */
compile 'com.android.support:multidex:1.0.1'
}
现在创建一个应用程序Singleton类并覆盖attachBaseContext()
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
别忘了在清单中声明它
<application
android:name=".AppController" <!-- Your Application Singleton Class Name -->
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
...
...
</application>
由于android studio中的内存限制,您仍然可能会遇到GC错误。 尝试清理您的项目,然后重新构建。
你们都准备好了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.