Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to transform 'com.android.tools.build\builder\3.1.4\...\builder-3.1.4.jar' using Jetifier. Reason: duplicate entry: module-info.class. #1414

Closed
jdelga opened this issue Dec 3, 2018 · 5 comments

Comments

@jdelga
Copy link

jdelga commented Dec 3, 2018

I am trying to migrate my current project to an instant apps base feature with base and installed modules (at the momento no instant module) and I am getting this error:

:base:kaptGenerateStubsReleaseKotlin
ERROR: [TAG] Failed to resolve variable '${animal.sniffer.version}'
:base:kaptGenerateStubsReleaseKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':base:kaptGenerateStubsReleaseKotlin'.
> Could not resolve all artifacts for configuration ':base:releaseCompileClasspath'.
   > Failed to transform file 'builder-3.1.4.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
      > Failed to transform 'C:\...\.gradle\caches\modules-2\files-2.1\com.android.tools.build\builder\3.1.4\...\builder-3.1.4.jar' using Jetifier. Reason: duplicate entry: module-info.class. (Run with --stacktrace for more details.) To disable Jetifier, set android.enableJetifier=false in your gradle.properties file.

I am using Android SDK 28, AndroidX and Butterknife-9.0.0-rc2

This is my dependency tree:

image

The version builder:3.1.4 is incompatible with androidx, but butterknife 9.0.0-rc2 is already compatible with AndroidX, right?

My project compiles correctly with androidX and 9.0.0-rc2 without using plugin apply plugin: 'com.android.feature'

My root build.gradle file:

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-rc2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

My base feature module build.gradle file:

apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
apply plugin: 'com.jakewharton.butterknife'

apply plugin: 'com.google.cloud.tools.endpoints-framework-client'

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        // V2: Add the new Endpoints Framework plugin dependencies
        classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
    }
}

android {
    compileSdkVersion 28

    baseFeature true

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 2302
        versionName "2.3.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        setProperty("archivesBaseName", "phone-release-$versionCode")

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

ext {
    butterknifeVersion = "9.0.0-rc2"
}

dependencies {
    application project(':installed')

    annotationProcessor "com.jakewharton:butterknife-compiler:${butterknifeVersion}"

    debugImplementation 'com.facebook.stetho:stetho:1.5.0'

    endpointsServer project(path: ':api', configuration: 'endpoints')

    implementation(project(':core'))
    implementation 'com.annimon:stream:1.2.1'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation('com.google.api-client:google-api-client:1.23.0') {
        exclude module: 'httpclient'
    }
    implementation('com.google.api-client:google-api-client-android:1.23.0') {
        exclude module: 'httpclient'
    }
    implementation "com.google.android.gms:play-services-maps:16.0.0"
    implementation "com.google.android.gms:play-services-analytics:16.0.5"
    implementation "com.google.android.gms:play-services-location:16.0.0"
    implementation 'com.google.firebase:firebase-core:16.0.5'
    implementation "com.google.firebase:firebase-ads-lite:17.1.1"
    implementation "com.google.firebase:firebase-messaging:17.3.4"
    implementation "com.google.firebase:firebase-config:16.1.0"
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation "com.jakewharton:butterknife:${butterknifeVersion}"
    implementation "com.jakewharton:butterknife-gradle-plugin:${butterknifeVersion}"
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.2'
    implementation group: 'io.reactivex.rxjava2', name: 'rxandroid', version: '2.0.2'
}

sourceCompatibility = "1.8"
targetCompatibility = "1.8"

apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
@jdelga jdelga changed the title ailed to transform 'com.android.tools.build\builder\3.1.4\...\builder-3.1.4.jar' using Jetifier. Reason: duplicate entry: module-info.class. Failed to transform 'com.android.tools.build\builder\3.1.4\...\builder-3.1.4.jar' using Jetifier. Reason: duplicate entry: module-info.class. Dec 3, 2018
@JakeWharton
Copy link
Owner

The Gradle plugin should be added to the buildscript classpath and not the app's implementation config. Please see the readme for a copy/paste example.

@jdelga
Copy link
Author

jdelga commented Dec 4, 2018

Thank you Jake, but I had it inside buildscript. I have edited the description with my full root build.gradle file. Previously I had only added part of it.

Actually, I can import R2 in my files, but it won't compile. I am still having the issue

@jdelga
Copy link
Author

jdelga commented Dec 4, 2018

The com.android.tools.build supports androidX only starting in version 3.2.0. I think that the butterknife-gradle-plugin should update its dependency at least to 3.2.0 or the latest version which is 3.2.1

@JakeWharton
Copy link
Owner

You shouldn't rely on the transitive dependency of our compiler for providing the Android Gradle plugin so our version shouldn't matter

@jdelga
Copy link
Author

jdelga commented Dec 4, 2018

The fact is that the only place I have a dependency on builder:3.1.4 is internally butterknife.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants