如何修复gradle中的“程序类型已存在”?

时间:2019-06-13 14:30:25

标签: java android

我对此仍然很陌生,还是一个学生。我正在尝试在Android Studio中构建应用,但我不知道在添加或删除gradle时出错了。

我检查了许多与此错误有关的StackOverflow问题,但是答案都是特定于某些库的。

从其他StackOverflow答案中,我发现它与gradle文件有关。因此,这是app / build.gradle:

    `apply plugin: 'com.android.application'

    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.example.jaaay.firebaseregister"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        packagingOptions {
            pickFirst 'lib/armeabi-v7a/libassmidi.so'
            pickFirst 'lib/x86/libassmidi.so'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/ASL2.0'
        }
    }

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-annotations:28.0.0'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.google.firebase:firebase-database:17.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-storage:17.0.0'
    implementation files('libs/CircleImageView-master/gradle/wrapper/gradle-wrapper.jar')
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation files('libs/Android-Image-Cropper-master/gradle/gradle/wrapper/gradle-wrapper.jar')
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'

}
apply plugin: 'com.google.gms.google-services'`

这是问题:

Program type already present: org.gradle.cli.CommandLineOption
Message{kind=ERROR, text=Program type already present: org.gradle.cli.CommandLineOption, sources=[Unknown source file], tool name=Optional.of(D8)}

0 个答案:

没有答案