2

I need the org.springframework.data.geo.Point class in my Spring Android app. I have the spring-android dependency already downloaded here. This does not have the .data section. When I try to use Gradle to import a different library I get duplication file errors. After consulting this link I get errors involving Dex cannot parse version 52 byte code. While reviewing this previous post I read that this wasn't the recommend way of getting rid of these errors.

Is there a spring library that I can import that has the org.springframework.data as well as everything given in the org.springframework.android:spring-android-rest-template:2.0.0.M3 library.

My build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.example.avi.myapplication"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

packagingOptions {
    exclude 'META-INF/ASL2.0'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/notice.txt'
    //pickFirst 'META-INF/spring.schemas'
    //pickFirst 'META-INF/spring.tooling'
    //pickFirst 'META-INF/spring.handlers'
    //pickFirst 'META-INF/spring.factories'
  }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})


compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
}

repositories {
maven {
    url 'https://repo.spring.io/libs-milestone'
}
}

Error Message after following this:

Error:Execution failed for task 

':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/spring.schemas
    File1: C:\Users\Avi.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.0.2.RELEASE\1befa3239976b856202b1735531910a0c2f4e17f\spring-data-commons-2.0.2.RELEASE.jar
    File2: C:\Users\Avi.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.0.2.RELEASE\301ee07b390bc8b5691f4206411b49beb06f7ff2\spring-beans-5.0.2.RELEASE.jar

Error Message after following this:

Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
user7922501
  • 420
  • 1
  • 5
  • 12

0 Answers0