Android Studio中重复输入 [英] Duplicate Entry in Android Studio
问题描述
apply plugin:'com.android.application'
dependencies {
compile fileTree(dir:'libs',include:'* .jar')
compile project(':appcompat_v7' )
编译项目(':google-play-services_lib')
编译项目(':Cognalys')
// noinspection GradleDynamicVersion
compile'com.android.support:recyclerview -v7:22.2。+'
}
android {
compileSdkVersion 22
buildToolsVersion23.0.0 rc3
sourceSets {
main {
manifest.srcFile'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
//将测试移动到tests / java,tests / res等...
instrumentTest.setRoot('tests')
debug.setRoot('build-types / debug')
release.setRoot('build-types / release')
}
defaultConfig {
//启用多重支持。
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules。 pro'
}
}
}
这个问题是重复条目,当.java成为.class不同的jar可能有同一个类时,你的项目可能依赖于许多不同的libs,可能有许多jar,所以key解决这个错误是避免重复的jar,尽可能使用在线依赖不是本地的jar,所有这些东西都可以配置你的毕业
:编译文件('libs / com.nostra13.universalimageloader:universal-image-loader:1.9.5')需要改为compile'com.nostra13.universalimageloader:universal-image-loader:1.9.5'。
如果您必须使用本地jar,请确保在您身上r项目和项目的库依赖于它们共享一个jar。
I am able to build the Project successfully in Android Studio but when I am trying to run the application getting error like this "duplicate entry: android/support/v4/print/PrintHelper$1.class.",I have searched lot of sites and tried lot of suggestions but failed.Please help me..below is my code.I was struggled 2 days for this.
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':appcompat_v7')
compile project(':google-play-services_lib')
compile project(':Cognalys')
//noinspection GradleDynamicVersion
compile 'com.android.support:recyclerview-v7:22.2.+'
}
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
This question is that "duplicate entry " ,when ".java" become ".class" different jar maybe have the same class, your project maybe depend on many different libs which may have many jars ,so the key to solve this error is that avoid duplicate jar,as much as possible use online depend on not local jars,all this things can config in your gradle
for example: compile files('libs/com.nostra13.universalimageloader:universal-image-loader:1.9.5') need to change to compile'com.nostra13.universalimageloader:universal-image-loader:1.9.5'.
If you have to use a local jar, please make sure that in your prject and the libs that project depends on they share one jar.
这篇关于Android Studio中重复输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!