如何使用Gradle将org.springframework.data导入Android Studio

时间:2018-01-16 23:02:14

标签: android spring gradle

我需要在我的Spring Android应用程序中使用org.springframework.data.geo.Point类。我已经下载了{-3}}的spring-android依赖项。这没有Dex cannot parse version 52 byte code部分。当我尝试使用Gradle导入不同的库时,我得到重复文件错误。在咨询here链接后,我收到涉及org.springframework.android:spring-android-rest-template:2.0.0.M3的错误。在回顾this之前的帖子时,我读到这并不是推荐摆脱这些错误的方法。

我是否可以导入具有org.springframework.data的弹簧库以及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: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
关注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.
关注this之后的

错误消息:

example.com

0 个答案:

没有答案