Reputation: 168
I can not build a Android Studio project. I get this error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_71\bin\java.exe'' finished with non-zero exit value 1
MultiDex is enabled in app.gradle:
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId 'my.app'
minSdkVersion 14
targetSdkVersion 23
versionCode 4
versionName "1.1.0"
multiDexEnabled true
}
...
I tried to remove "build" folders, but it didn't give me any result. How I can solve this problem?
EDIT: This project builds on other computer (Mac Mini / OS X), but doesn't build's on my computer (Windows)
Upvotes: 0
Views: 900
Reputation: 381
You can try the following steps to resolve the issue:
Step 1: Add a class named as MyApplication and extend it with MultiDexApplication class.
Step 2: Declare this MyApplication class name in your application tag in manifest.
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
Step 3: Override the attachBaseContext in the MyApplication class and call Multidex.install() method:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Try running the project with the above changes and it should work!
Upvotes: 1
Reputation: 412
This is because the dependencies repeat.Plesae modify this mistake , clean and rebuilt this project.
Upvotes: 0