代码之家  ›  专栏  ›  技术社区  ›  Cyrus

程序类型已经存在:org.hamcrest.coremachers

  •  5
  • Cyrus  · 技术社区  · 7 年前

    message kind=error,text=program type already present:org.hamcrest.coremachers,sources=[未知源文件],tool name=optional.of(d8)

    here 但无法得到正确的答案。

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        useLibrary 'org.apache.http.legacy'
        defaultConfig {
            minSdkVersion 15
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            ndk {
                ndk {
                    moduleName "exec"
                    abiFilters 'armeabi-v7a'
                }
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        sourceSets {
            main {
                jni.srcDirs = []
                jniLibs.srcDirs = ['libs']
                res.srcDirs = ['src/main/res']
                assets.srcDirs = ['src/main/assets']
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
        configurations.all{
            resolutionStrategy.force 'org.hamcrest:hamcrest-core:1.1'
        }
    
    }
    
    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.j256.ormlite:ormlite-core:4.41'
        implementation 'com.j256.ormlite:ormlite-android:4.41'
        implementation 'com.googlecode.json-simple:json-simple:1.1.1'
        implementation 'org.mozilla:rhino:1.7.10'
    }
    

    3 回复  |  直到 6 年前
        1
  •  7
  •   M D P    7 年前

    json-simple 1.1.1 把它放进去 libs

    implementation 'com.googlecode.json-simple:json-simple:1.1.1' build.gradle

        2
  •  0
  •   hannibal1296    7 年前

        3
  •  0
  •   Luksurious    6 年前

    json-simple 也解决了这个问题:

    implementation('com.googlecode.json-simple:json-simple:1.1.1') {
        exclude group: 'junit', module: 'junit'
    }
    

    simple-json hamcrest-core:1.1 hamcrest-core:1.3

    推荐文章