build.gradle(模块:应用)

apply plugin: 'com.android.application'
apply plugin: 'com.apollographql.android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.startup.grandinvit"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {

            //useProguard true
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        debug {

            debuggable true
            //useProguard true
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


        }
    }
}



dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'androidx.appcompat:appcompat:1.0.2'

    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'com.google.firebase:firebase-firestore:17.1.2'
    androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.1'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    implementation 'androidx.appcompat:appcompat:1.0.0'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-vision:17.0.2'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
    implementation 'com.airbnb.android:lottie:2.0.0-rc1'


    // Check for v11.4.2 or higher
    implementation 'com.google.firebase:firebase-core:16.0.6'

    // Add dependency
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
    //implementation 'org.jetbrains:annotations-java5:15.0'
    //implementation 'org.jetbrains:annotations:16.0.2'

    implementation 'com.apollographql.apollo:apollo-runtime:1.0.0'
    implementation "com.apollographql.apollo:apollo-android-support:1.0.0"

    implementation "androidx.annotation:annotation:1.1.0"
    androidTestImplementation "com.android.support:support-annotations:28.0.0"



}

构建项目时,出现错误“错误:包android.support.annotation不存在”

我尝试了以下解决方法。
  • 在* .java文件中,我尝试注释并再次添加导入。
  • 我尝试添加添加“androidx.annotation:annotation:1.1.0”

  • 但仍然没有运气。

    gradle.properties
    org.gradle.jvmargs=-Xmx1536m
    android.enableR8=true
    android.useAndroidX=true
    android.enableJetifier=true
    

    非常感谢您的事先帮助,我已经坚持了很长时间,我们将不胜感激。

    最佳答案

    尝试从以下位置更改:

    androidTestImplementation "com.android.support:support-annotations:28.0.0"
    


    implementation "com.android.support:support-annotations:28.0.0"
    

    10-06 13:28
    查看更多