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'
答案 0 :(得分:0)
启用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);
}
}
现在在你最明显的文件中添加
<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
答案 1 :(得分:0)
MultiDex库支持没有问题。主要问题是google.gms播放服务的版本。
compile 'com.google.android.gms:play-services-analytics:11.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'
使应用程序崩溃。我只需要通过android sdk管理器更新我的谷歌服务。然后将版本号从11.0.1更改为11.0.4。这只是插件版本问题,它崩溃了应用程序并混淆了错误消息。