when i want to sync gradle i get this error:
Error:Access to the dex task is now impossible, starting with 1.4.0
1.4.0 introduces a new Transform API allowing manipulation of the .class files.
See more information: http://tools.android.com/tech-docs/new-build-system/transform-api
When i click the link, i don't find any solution. Anyone have solution thanks.
set your gradle version explicitly to 1.3.0 in dependencies section of build.gradle file
classpath 'com.android.tools.build:gradle:1.3.0'
As suggested in other answers, downgrade is one option. But, it is not a solution. As asked by David Argyle Thacker, what if we actually want to use a newer version (of gradle build tool)?
I was having same trouble while upgrading gradle tool version in one of my projects. So, I did following and voila, it worked.
Add multiDexEnabled true to the defaultConfig in /app/build.gradle.
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
multiDexEnabled true
}
Remove all the code you have previously written to get MultiDexing to work. For instance,
Remove the afterEvaluate
block for MultiDex
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex'
// this is optional
// dx.additionalParameters += "--main-dex-list=$projectDir/multidex-classes.txt".toString()
}
}
Remove multidex
dependency
dependencies {
...
compile 'com.android.support:multidex:1.0.1'
}
Remove the code from AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pcsalt.multidex">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
If you are using custom Application class by extending android.app.Application, then remove MultiDex.install(base);
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(base);
}
Update the build tool version to 2.1.2
(highest stable version available at the time of writing) in /build.gradle
classpath 'com.android.tools.build:gradle:2.1.2'
Gradle Sync the project, by clicking Sync now
Hope this helps.
http://www.pcsalt.com/android/solution-access-dex-task-now-impossible-starting-1-4-0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With