0

For some reason, I am getting a strange error after adding Retrofit to a project that I inherited. If I remove Retrofit, the project builds but If I add it back then the error will re-appear.

How can I fix this issue? any suggestion is welcomed.

Here is the gradle file apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.domain.appname"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

repositories {
    mavenLocal()
    flatDir {
        dirs 'libs'
    }
    maven { url 'https://maven.fabric.io/public' }
}



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:recyclerview-v7:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-crash:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-config:10.0.1'
    compile 'com.google.firebase:firebase-invites:10.0.1'
    compile 'com.google.firebase:firebase-appindexing:10.0.1'
    compile 'com.firebaseui:firebase-ui:1.0.1'
    compile 'com.firebase:geofire-android:2.1.0'
    compile 'com.makeramen:roundedimageview:2.2.1'
    compile 'com.google.android.gms:play-services-maps:10.0.1'
    compile 'com.karumi:dexter:2.3.1'
    compile files('libs/YouTubeAndroidPlayerApi.jar')


    compile 'com.google.code.gson:gson:2.7'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-simplexml:2.1.0'

}

And here is a screenshot of the error message that I am getting.

https://dl.dropboxusercontent.com/u/15447938/downloads/gradle_error.png

I ran gradlew app:dependencies and it was pointing to "UnsupportedClassVersionError"

Caused by: java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
        at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:71)
        at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:51)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
Val Okafor
  • 3,371
  • 13
  • 47
  • 72

1 Answers1

0

This turns out to be some transitive dependencies that Simple XML converter have on Android core. I fixed the issue per this StackOverflow question like this

compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile ('com.squareup.retrofit2:converter-simplexml:2.1.0'){
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
    }
Community
  • 1
  • 1
Val Okafor
  • 3,371
  • 13
  • 47
  • 72