我試圖使用gradle這個在我的Android組建導入https://github.com/Kickflip/kickflip-android-sdk和我越來越:排除的.class從搖籃dependecy文件
意外頂級例外: com.android.dex.DexException:多個dex文件定義了Lorg/apache/commons/codec/binary/Base64;
Commons.codec是我的項目的依賴項,但不是直接的kick-flip項目,我認爲它來自其中的一個jar包。如果我打開Kickflip的classes.jar,我可以看到.class文件。
如何將Base64.class從kickflip導入到最終版本中?我已經看過使用ziptree排除東西,但一直沒有能夠得到任何工作。
感謝
我的build.gradle是:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/ASL2.0'
}
android.applicationVariants.all{ variant ->
// This is an annoying hack to get around the fact that the Gradle plugin does not support
// having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread)
// but Android Maps Utils supports 8 (Froyo) still
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/exploded-aar/io.kickflip/sdk/0.9.9/AndroidManifest.xml")
if (manifestFile.exists()) {
println("Replacing minSdkVersion in Android Maps Utils")
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="18"/, 'minSdkVersion=\"10\"')
manifestFile.write(content, 'UTF-8')
println(content)
}
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile 'io.kickflip:sdk:0.9.9'
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':libs:typeface-textview:library')
compile project(':libs:gpuimage')
compile 'com.google.android.gms:play-services:4.3.23'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.koushikdutta.urlimageviewhelper:urlimageviewhelper:1.0.4'
compile ('fr.avianey:facebook-android-api:3.14.0') {
exclude module: 'support-v4'
}
compile 'com.github.japgolly.android:svg-android:2.0.1'
compile 'org.scribe:scribe:1.3.5'
compile 'commons-codec:commons-codec:1.8'
}
我看到kickflip需要最小的Android SDK版本18和你的構建文件定義了minSdkVersion 10.這可能是一個問題。 – Genry
我試圖建立它。他們似乎在說必須使用構建工具19.1並且正在說要從Gradle命令行構建。我使用的是Android Studio,因此這些示例只是抱怨Gradle版本要支持舊版本。 Eclipse的簡單下載按鈕已從developer.android.com中刪除。 – Giuseppe
在Eclipse中我得到了多個dex錯誤,它通常與不正確的庫鏈接有關,或者可能多次包含一個庫。這也許就是他們爲什麼建議使用Gradle命令行構建的原因。 – Giuseppe