Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\faisal\.android\build-cache\b8fc169a71d6759757864b00f302f95b66921263\output\jars\classes.jar' to 'C:\Users\faisal\Desktop\application-app-search-global\app\build\intermediates\transforms\dex\debug\folders\1000\10\classes_abbf8d2bb1ffecc7fb77ef565c2873fc6625cf3d'
最佳答案
启用multidex,如下所示:
android {
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
// add dependencies for multidex
compile 'com.android.support:multidex:1.0.1'
}
创建一个这样的类
public class Multi_Dex extends Application {
@Override
protected void attachBaseContext(Context context) {
super.attachBaseContext(context);
MultiDex.install(this);
}
}
现在在您的 list 文件中添加此
<application
android:name=".Multi_Dex" <!-- this line enable multi-dex application -->
android:allowBackup="true" <!-- rest of them doesen't matter to enable multi-dex -->
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
了解更多信息click here
关于android - Android的MultiDex支持问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45810997/