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类
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。