android - Android Studio中的重复条目

标签 android android-studio duplicates

我能够在Android Studio中成功构建项目,但是当我尝试运行该应用程序时,出现诸如“重复项:android / support / v4 / print / PrintHelper $ 1.class”之类的错误,我已经搜索了很多网站,并且尝试了很多建议,但失败了。请帮助我..以下是我的代码。为此我苦了2天。

 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'
        }
    }
}

最佳答案

我遇到了同样的错误,我已经解决了,但我只是把你的情况告诉你。

我的bulid.gradle:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile ('com.android.support:appcompat-v7:22.0.0') 
    compile files('libs/android-async-http-1.4.8.jar')
    compile files('libs/android-support-v4.jar')
    compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}

错误的原因是com.android.support:appcompat-v7:22.0.0包含support-v4.jar,因此我将其删除;

解决build.gradle:
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile ('com.android.support:appcompat-v7:22.0.0') {
        exclude module: 'support-v4'
    }
    compile files('libs/android-async-http-1.4.8.jar')
    compile files('libs/android-support-v4.jar')
    compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}

所以也许您应该检查您的依赖关系,也许您的编译文件有两个文件,包括support-v4

关于android - Android Studio中的重复条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32007296/

相关文章:

android - 构建 Cordovo Android 应用程序失败 - Dex 无法解析版本 52 字节代码错误消息

android - 如何使用 android 中 desfire 提供的安全功能?

android - java.lang.ClassCastException : android. graphics.drawable.BitmapDrawable 无法转换为 android.graphics.drawable.LayerDrawable

android - 错误您需要将 Theme.AppCompat 主题(或后代)与 Activity 一起使用

安卓工作室 : Unresolved symbol "Theme" in styles. xml

R 保留重复行中 nas 最少的行

java - 使用 Java 8 流在一行而不是两行中删除重复项

java - 在 ScrollView android中滚动时 float 操作按钮隐藏和显示?

android - 如何在 android 中监听网络连接

mysql - 基于位掩码在mysql中查找重复记录