更新时间:2023-11-20 10:12:46
请确保您有最新版本toolds和SDK的SDK管理器。我已经转换的罐
到摇篮
相关性。
build.gradle
: //***构建文件,你可以到各子项目/模块添加常用的配置选项。
buildscript {
库{
jcenter()
行家{URLHTTP://ksoap2-android.google$c$c.com/svn/m2-repo'} //< - 对于KSOAP添加
}
依赖{
类路径com.android.tools.build:gradle:1.1.3'//< - 更新
}
}
allprojects {
库{
jcenter()
行家{URLHTTP://ksoap2-android.google$c$c.com/svn/m2-repo'} //< - 对于KSOAP添加
}
}
应用程序/ build.gradle
: 应用插件:com.android.application
安卓{
compileSdkVersion 22
buildToolsVersion22.0.1//< - 更新
defaultConfig {
的applicationIDcom.appname.android
的minSdkVersion 8
targetSdkVersion 22 //< - 更新
// multiDexEnabled真//< - 你不需要这个
}
buildTypes {
推出 {
minifyEnabled假
proguardFiles getDefaultProguardFile('ProGuard的-android.txt'),'ProGuard的-rules.txt
}
}
}
依赖{
编译com.android.support:support-v4:22.1.1
编译com.google code.ksoap2-机器人:ksoap2-安卓3.4.0
//编译文件(库/ ksoap2-机器人组装-3.1.0-JAR-与-dependencies.jar)//< - 避免使用广口瓶
copmilecom.google.zxing:核心:3.2.0
//提供的文件(库/ zxing-core.jar添加)//< - 避免使用广口瓶
}
I have been battling this error all day in Android Studio. Project was imported from an eclipse solution. I have been trying to implement all fixes that are listed for similar posts, nothing is working. I am an Android beginner.
I will be happy to provide any further information.
Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/google/zxing/BarcodeFormat.class
Please help!! Should I just try to get it to run in Eclipse?
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.appname.android"
minSdkVersion 8
targetSdkVersion 18
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.1.1'
compile files('libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar')
provided files('libs/zxing-core.jar')
}
Make sure you have the latest build toolds and sdk from the SDK manager. I have converted those jars
to Gradle
dependencies.
build.gradle
:// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' } // <-- added for ksoap
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3' // <-- updated
}
}
allprojects {
repositories {
jcenter()
maven { url 'http://ksoap2-android.googlecode.com/svn/m2-repo' } // <-- added for ksoap
}
}
app/build.gradle
:apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1" // <-- updated
defaultConfig {
applicationId "com.appname.android"
minSdkVersion 8
targetSdkVersion 22 // <-- updated
// multiDexEnabled true // <-- you do not need this
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.1.1'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.4.0'
// compile files('libs/ksoap2-android-assembly-3.1.0-jar-with-dependencies.jar') // <-- avoid using jars
copmile 'com.google.zxing:core:3.2.0'
// provided files('libs/zxing-core.jar') // <-- avoid using jars
}