我使用Android Studio将现有的Android项目迁移到Android X,但是我无法导入/解决任何Androidx库 - 我在做什么错?
我最近使用自动化的Android Studio路线将一个旧的Android项目迁移到Android X。我的Gradle依赖性都在那里,但是我无法使用任何Androidx库。您能建议我做错了什么吗?每当我尝试导入Android X库(即导入Androidx.Fragment.App.Fragment),我都会得到无法解决错误
compilesdkversion和targetsdkversion = 32和minsdkversion = 26
i也具有gradle属性
。 android.useandroidx = true
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
}
项目级别gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.google.gms:google-services:4.3.10'
// 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
}
I recently migrated an old android project to Android X using the automated Android Studio route. My gradle dependencies are all there, but I am unable to use any androidx library. Can you please advise on what I am doing wrong? Every time I try to import an Android X library (i.e. import androidx.fragment.app.Fragment) I get the cannot resolve error
compileSDKVersion and targetSdkVersion =32 and minSdkVersion =26
I also have gradle properties include the following
android.enableJetifier=true
android.useAndroidX=true
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
}
Project Level Gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.google.gms:google-services:4.3.10'
// 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
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加
在build.gradle文件中 和其他任何必要的依赖项。与Gradle同步项目,一切都可以。
Add
and any other necessary dependencies in your build.gradle file. Sync project with gradle and everything should be fine.