我的项目出现了一些问题,
为您提供信息,我已迁移到androidx库。我假设我所有的代码都会自动更改为androidx,但是只有其中一部分更改了。当前版本的Android Studio是3.5。
我做了什么
该应用程序已安装在我的设备上,但仍处于停止状态。这是我的详细信息:
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 class
答案 0 :(得分:0)
删除此
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.android.support:support-annotations:28.0.0'
并删除一次您的导入并重新导入
喜欢
import android.annotation.SuppressLint;