包android.support.annotation不存在

时间:2018-08-12 08:19:23

标签: android

我的gradle代码

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "gt.otomat7"
        minSdkVersion 22
        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'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    androidTestImplementation "com.android.support:support-annotations:27.1.1"
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation project(':libraries:tess-two')
}

但是我没有关于注释的错误,我正在使用tesseract库和我的android studio版本

Android Studio 3.1.4
Build #AI-173.4907809, built on July 24, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

感谢您的帮助

3 个答案:

答案 0 :(得分:3)

请更改为:

android.support.annotation

至:

androidx.annotation

答案 1 :(得分:2)

以下答案解决了我的问题: https://stackoverflow.com/a/56674446/643156

yarn add --dev jetifier
yarn run jetify

答案 2 :(得分:1)

由于您使用的是SDK版本28,因此将以下版本更改为

implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
androidTestImplementation "com.android.support:support-annotations:27.1.1"

implementation 'com.android.support:appcompat-v7:28.0.0'
androidTestImplementation "com.android.support:support-annotations:28.0.0"