Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug' android studio

I create a game on buildbox I export the project but I can't start the game on android studio My problem is that I can't run the application or produce an apk file

someone can help me please.

The error

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [C:\Users\youne\Desktop\android2\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\youne.gradle\caches\transforms-1\files-1.1\support-core-ui-25.2.0.aar\9adfc8649fc899fbc5e371e8bc1c399a\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/view/ViewPager$2.class]))

I am using

Android Studio 3.0

Java version: Java(TM) SE Runtime Environment (build 1.8.0_73-b02).

Gradle Version: com.android.tools.build:gradle:4.1

And i have Multidex enabled

In my app build.gradle file:

android {
  compileSdkVersion 27
  buildToolsVersion '27.0.1'

  defaultConfig {
    applicationId "com.drh.bird"
    minSdkVersion 14
    targetSdkVersion 23
    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false
    compileOptions.encoding = 'ISO-8859-1'
    multiDexEnabled = true

    ndk {
      moduleName "player_shared"
    }
  }
  android {
    useLibrary 'org.apache.http.legacy'
  }
  sourceSets {
    main {
      jni.srcDirs = []
    }
  }

  buildTypes {}
  android {
    defaultConfig {
      multiDexEnabled true
    }
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
  }

  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
  }
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
  compile 'com.google.android.gms:play-services:+'
  compile files('libs/dagger-1.2.2.jar')
  compile files('libs/javax.inject-1.jar')
  compile files('libs/nineoldandroids-2.4.0.jar')
  compile files('libs/support-v4-19.0.1.jar')
}
like image 756
Younss Drhouj Avatar asked Nov 17 '17 01:11

Younss Drhouj


2 Answers

implementation 'com.android.support:appcompat-v7:27.1.0'
 implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
 implementation 'com.android.support:recyclerview-v7:27.1.0'

update your all support library to 27.1.0 like above and remove duplicates

like image 158
Ashwin H Avatar answered Nov 14 '22 22:11

Ashwin H


You are trying to use compile files('libs/support-v4-19.0.1.jar') with compileSdkVersion 27. But support library should have major version equal to compileSdkVersion

Use implementation "com.android.support:support-v4:27.0.1" instead it

Also, never use + in dependencies version. You may get some problems, when dependency has updated

like image 36
DeKaNszn Avatar answered Nov 14 '22 23:11

DeKaNszn