开发者社区> 问答> 正文

android.annotation无法导入:无法解析所有注释

0

我是在Android Studio平台上开发移动应用程序的新手。我的项目出现了一些问题:

android.annotation无法解析。 供您参考,我已迁移到androidx库。我假设我所有的代码都会自动更改为androidx,但是只有其中一部分更改了。当前版本的Android Studio为3.5。

我做了什么

无效并重新启动 清理并重建 已选择sdk的所有路径 该应用程序已安装在我的设备上,但仍处于停止状态。这是我的详细信息:

的build.gradle(项目)

buildscript { repositories { google() jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    //classpath 'com.google.gms:google-services:3.2.0'
    classpath 'com.google.gms:google-services:4.3.2'
    //classpath 'com.google.gms:google-services:4.3.2'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

allprojects { repositories { google() jcenter()

}

}

task clean(type: Delete) { delete rootProject.buildDir } build.gradle(模块应用)

apply plugin: 'com.android.application'

android { compileSdkVersion 28 buildToolsVersion '28.0.3'

defaultConfig {
    applicationId "com.kartik.barcode"
    minSdkVersion 17
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {

        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' //implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.legacy:legacy-support-core-utils:1.0.0' implementation 'androidx.legacy:legacy-support-core-ui:1.0.0' implementation 'androidx.fragment:fragment:1.0.0' implementation 'androidx.multidex:multidex:2.0.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.palette:palette:1.0.0' implementation 'androidx.preference:preference:1.0.0' implementation 'androidx.core:core:1.0.0' implementation 'androidx.media:media:1.0.0' implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0' implementation 'androidx.browser:browser:1.0.0' implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar' implementation 'com.google.zxing:core:3.2.0' implementation 'com.google.firebase:firebase-database:19.1.0'//for firebase implementation 'com.google.firebase:firebase-auth:19.0.0' implementation 'com.google.firebase:firebase-storage:19.0.1' implementation 'com.google.firebase:firebase-messaging:20.0.0' implementation 'com.google.firebase:firebase-appindexing:19.0.0' implementation 'com.google.firebase:firebase-firestore:21.1.1' implementation 'com.google.firebase:firebase-analytics:17.2.0' implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.google.android.gms:play-services-auth:17.0.0' implementation 'com.google.android.gms:play-services-ads:18.2.0' implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.annotation:annotation:1.1.0' //annotationProcessor 'androidx.annotation:annotation:1.1.0' implementation 'com.android.support:support-annotations:28.0.0'

}

apply plugin: 'com.google.gms.google-services' 这里出现问题 logcat

当我查看java类时,导入仍然是android,而不是androidx。即使我更改为androidx,也仍然无法解决。 Java类

展开
收起
被纵养的懒猫 2019-09-25 16:01:09 1549 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
神龙云服务器产品及技术深度解析 立即下载
弹性创造价值:基于ECS的最佳性价比实践解析 立即下载
又快又稳:阿里云下一代虚拟交换机解析 立即下载

相关镜像