1

My app was building and running fine previously, but then when I implemented Gson in my gradle, it gave me an error while building

My app's gradle:

apply plugin: 'com.android.application'

android {

    compileSdkVersion 27
    buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.google.sample.cloudvision"
        minSdkVersion 24
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        buildTypes.each {
            it.buildConfigField 'String', 'API_KEY', "\"AIzaSyDHRKU5yH5Tc-IphIYL3TwkSG58uah6e3I\""
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.google.api-client:google-api-client-android:1.23.0' exclude module: 'httpclient'
    implementation 'com.google.http-client:google-http-client-gson:1.23.0' exclude module: 'httpclient'
    implementation 'com.google.apis:google-api-services-vision:v1-rev369-1.23.0'
    implementation 'com.google.code.gson:gson:2.8.6'
}

Before adding in that last implementation line, everything was ok. And when I tried building, it gave an error at "Execute task action 5/5 for :app:transformClassesWithDesugarForDebug"

I'd post the error message here but it exceeded the character count limit, not sure how I can do that

Edit: fixed. Changed to

android {   
    compileSdkVersion 26
    buildToolsVersion "26.0.1"

and

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
Dan
  • 195
  • 3
  • 12

0 Answers0