question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle build process failed with "minifyEnabled" - Proguard

See original GitHub issue

I’ve got received this error when minifyEnabled is true:

Error:Execution failed for task ':app:transformClassesWithNewClassShrinkerForDebug'.
> [PROJECT_PATH]/app/build/intermediates/exploded-aar/com.google.firebase/firebase-common/9.2.0/proguard.txt line 37:14 no viable alternative at input 'com.google.android.gms.common.util.DynamiteApi'

project build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath "com.google.gms:google-services:3.0.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

App build.gradle:

buildscript {
    repositories {
        jcenter()
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion '24.0.0'

    defaultConfig {
        applicationId "MY_APP_ID"
        minSdkVersion 21
        targetSdkVersion 24
        versionCode 1
        versionName "1.0.0"
        vectorDrawables.useSupportLibrary = true
    }
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
    buildTypes {
        debug {
            minifyEnabled true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
}

dependencies {
    compile "com.android.support:support-v4:24.0.0"
    compile "com.android.support:appcompat-v7:24.0.0"
    compile "com.android.support:recyclerview-v7:24.0.0"
    compile "com.android.support:cardview-v7:24.0.0"
    compile "com.android.support:design:24.0.0"
    compile "com.android.support:support-annotations:24.0.0"
 // ... others libs
    compile "com.google.firebase:firebase-messaging:9.2.0"
}

apply plugin: 'com.google.gms.google-services'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
samtsterncommented, Jul 6, 2016

@dsdebastiani this is a known issue (recently discovered) that the 9.2.0 client libraries do not work with the Jack compiler or the new Android class shrinker. While we work on a fix, you have the following options:

  • Go back to the ‘stable’ android compiler
  • Use the 9.0.2 libraries which are nearly identical to 9.2.0 minus a few small fixes
0reactions
Udbhav12commented, Jan 16, 2019

@hiepnm - Do we need to add all of the above lines or only the first line (-keep class com.firebase.** { *; }) ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle build process failed with "minifyEnabled" - Proguard
When trying to compile my app I get the following error: ... Gradle build process failed with "minifyEnabled" - Proguard #327.
Read more >
Gradle build failed when minify is enabled - Stack Overflow
Gradle build fails when I set minifyEnabled true in release type. I tried to include all the proguard rules but still getting error...
Read more >
Gradel error with minifyEnabled false (Example) - Treehouse
It is using a version of Gradle that is unsupported (Android only supports 1.0 and up). The Gradle files seem to have gone...
Read more >
Shrink, obfuscate, and optimize your app - Android Developers
When you build your project using Android Gradle plugin 3.4.0 or higher, the plugin no longer uses ProGuard to perform compile-time code optimization....
Read more >
Provide a default proguard configuration [37009313]
Using Android Studio 0.9.1, with Gradle 0.14.1, I am working with a NDK project that is having problems when I try to set:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found