【问题标题】:Error: Program type already present: org.intellij.lang.annotations.JdkConstants$PatternFlags 3错误:程序类型已经存在:org.intellij.lang.annotations.JdkConstants$PatternFlags 3
【发布时间】:2018-12-29 12:34:31
【问题描述】:

我仍然遇到这个错误。我删除了 build 文件夹、.gradle 文件夹和 gradle 文件夹。构建时仍然出现相同的错误。我没有什么可以尝试的想法。这是我当前的 build.gradle(应用级别)

apply plugin: 'com.android.application'

configurations {
    cleanedAnnotations
    compile.exclude group: 'org.jetbrains' , module:'annotations'
}

android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId 'ch.workouttracker'
        minSdkVersion 24
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "0.5"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resConfigs "de" // And any other languages you support
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions{
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'

    }
    defaultConfig {
        vectorDrawables.useSupportLibrary = true

    }
    productFlavors {
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}


allprojects {
    repositories {
        maven { url = "https://maven.fabric.io/public" }
    }
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //Firebase
    implementation 'com.google.firebase:firebase-core:16.0.6'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.firebase:firebase-database:16.0.5'
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    //Graphview
    implementation 'com.jjoe64:graphview:4.2.1'
    implementation 'org.apache.commons:commons-lang3:3.4'
    //Google Play
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-identity:16.0.0'
    //FirebaseUI
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.firebaseui:firebase-ui-storage:1.2.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
    implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
    //Support
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:support-core-utils:27.1.1'
    implementation 'com.android.support:support-media-compat:27.1.1 '
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:gridlayout-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:preference-v7:27.1.1'
    //Firebase
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
    implementation 'com.google.firebase:firebase-plugins:1.1.5'
    implementation 'com.android.support:multidex:1.0.3'
}

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

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

您对我接下来可以尝试什么有什么想法吗?欢迎任何想法,我不知道我还能尝试什么。我一直在开发,但我无法再构建它,这使得它很难退出。

【问题讨论】:

  • 唯一的答案确实是 100% 复制和粘贴......虽然这个 build.gradle 有两个主要问题。无知不是正确的解决办法。这里的笑话是一个成功的复制和粘贴操作的 25 xp ...vs。 0 xp 用于实际解决这两个问题。

标签: android android-studio gradle


【解决方案1】:

我真的不知道有什么问题。我试图在谷歌上搜索找到一些解决方案。

我想出的唯一一件事是请在您的应用级别 build.gradle.

中添加以下行
configurations {
    cleanedAnnotations
    compile.exclude group: 'org.jetbrains' , module:'annotations'
}

希望这会有所帮助。我在等你的答复。

【讨论】:

  • 哦。我完全没看到对不起。
  • 没问题,我也发现了这个,但它似乎不起作用。
  • 还有一件事,试试这个:排除组:'com.intellij',模块:'注释'。应该不错
  • 非常感谢。它又在建了。你救了我的命
  • 没问题,如果你能给我正确的答案,我将不胜感激
【解决方案2】:

您的错误是 org.intellij.lang.annotations.JdkConstants$PatternFlags 3

也许你可以用这个

configurations {
    cleanedAnnotations
    compile.exclude group: 'org.jetbrains' , module:'annotations'
    compile.exclude group: 'com.intellij', module:'annotations'
    compile.exclude group: 'org.intellij', module:'annotations'
}

【讨论】:

    【解决方案3】:

    有了这段代码,我可以解决问题。

    configurations {
        cleanedAnnotations
        compile.exclude group: 'org.jetbrains' , module:'annotations'
        compile.exclude group: 'com.intellij', module:'annotations'
    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-05
      • 2019-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-23
      • 2019-02-22
      • 1970-01-01
      相关资源
      最近更新 更多