我正在尝试构建一个访问Spotify的公共API的应用程序的模型,这些是我需要使应用程序的服务和功能到目前为止工作。 gradle同步本身很好,但是当我尝试构建项目时,我遇到了这个问题:
错误:任务执行失败 ':应用程序:transformDexArchiveWithExternalLibsDexMergerForDebug'。 java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并 DEX
我尝试过的事情:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example.mostags.trial5"
minSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/java/com.example.mostags.trial5/methods']
}
}
}
repositories {
google()
jcenter()
mavenCentral()
flatDir {
dirs 'libs'
}
maven { url 'https://github.com/thelinmichael/spotify-web-api-java' }
}
android {
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
resolutionStrategy.force 'com.google.android.gms:play-services:11.2.2'
}
}
dependencies {
compile 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.jayway.jsonpath:json-path:2.0.0') {
exclude group: 'net.minidev', module: 'asm'
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
compile('com.amazonaws:aws-android-sdk-mobile-client:2.6.7@aar') { transitive = true; }
compile('com.amazonaws:aws-android-sdk-auth-userpools:2.6.+@aar') { transitive = true; }
compile('com.amazonaws:aws-android-sdk-auth-ui:2.6.+@aar') { transitive = true; }
compile 'net.sf.json-lib:json-lib:2.4:jdk15'
compile 'com.google.guava:guava:23.6-android'
compile 'com.google.protobuf:protobuf-java:3.5.1'
compile 'com.google.protobuf:protobuf-lite:3.0.1'
compile 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
compile('se.michaelthelin.spotify:spotify-web-api-java:1.5.0') {
exclude group: "commons-beanutils", module: "commons-beanutils"
}
compile 'commons-beanutils:commons-beanutils:20030211.134440'
compile 'commons-codec:commons-codec:1.11'
compile 'org.apache.httpcomponents:httpcore:4.4.8'
compile 'org.apache.httpcomponents:httpclient:4.5.4'
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true;
compile fileTree(include: ['*.jar'], dir: 'libs')
//these two lines are added
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
// This library handles authentication and authorization
compile 'com.spotify.android:auth:1.0.0-alpha'
}
我在MacOS Sierra 10.12.6上的Android Studio 3上运行。
这是我的傻瓜:
{{1}}
答案 0 :(得分:0)
试试这个
head