build failing on play-services:11.8.x with pro guard parser error

前端 未结 4 1342
执念已碎
执念已碎 2020-12-04 16:46

So it looks like there is a bug in the latest play-services to be deployed. Does anyone know how to work around this issue?

FAILURE: Build failed with an exc         


        
相关标签:
4条回答
  • 2020-12-04 17:04

    I am noticing that if you disable Instant Run the build still fails with the same error (if you have minify enabled but Proguard disabled to shrink your code to avoid multi-dex in the debug build). If you follow Brill Pappin answer you must enable Instant Run(and install libraries as prompted) to hit any breakpoints while debugging.
    It seems enabling the shrinker as described in the Google docs now only works if you are using Instant Run with the Google Play Play Services.

    0 讨论(0)
  • 2020-12-04 17:07

    This solution helped me:

    First, in app/build.gradle change useProguard to 'true'

    Second, in proguard rules add line '-dontobfuscate'

    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
            ...
        }
        debug {
            debuggable true
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
            ...
        }
    }
    

    proguard-rules.pro

    -dontobfuscate
    

    So, minify would be work, but code wouldn't obfuscate.

    0 讨论(0)
  • It seems the default shrinker has changed. Adding the configuration to turn on ProGuard seemed to work.

    buildTypes {
            release {
                debuggable false
                minifyEnabled true
                useProguard true
                ...
            }
            debug {
                debuggable true
                minifyEnabled true
                useProguard true
                ...
            }
        }
    
    0 讨论(0)
  • 2020-12-04 17:13

    In addition to the above solution (which works): the issue seems related to Instant Run as well. If you disable Instant Run, you can build your app without changing your build.gradle. Probably, the default shrinker has changed only when building for Instant Run.

    0 讨论(0)
提交回复
热议问题