我在建造Apk的过程中得到DuplicateFileException
。我使用GitHub的Applogic源代码开发了一个聊天应用程序,在构建gradle时,我得到了这个异常,无法构建apk。我使用的是Android Studio 3.0 Gradle版本3.3和Android插件版本2.3.3构建工具版本26.0.2 sdk版本API26
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.mobicomkit.sample"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ECLIPSE_.SF'
exclude 'META-INF/ECLIPSE_.RSA'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':mobicomkitui') //Note: use this for customization
compile 'com.applozic.communication.uiwidget:mobicomkitui:5.2'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:cardview-v7:26.0'
compile 'com.android.support:recyclerview-v7:26.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
transitive = true;
}
}
申请插件:'com.google.gms.google-services'enter image description here
答案 0 :(得分:1)
你不能同时使用gradle依赖和导入的applozic源代码以及你需要使用的任何一个
在导入源代码
的情况下使用此选项 compile project(':mobicomkitui') //Note: use this for customization
从您的app build.gradle文件中删除此代码
compile 'com.applozic.communication.uiwidget:mobicomkitui:5.2'