这个项目使用了AndroidX Dependencies,但是'android.useAndroidX' 属性没有启用
This project uses AndroidX Dependencies,but the 'android.useAndroidX' property is not enabled
我已经将我的 android build.gradle 更新到最新版本,现在我收到一个错误。
我已经在此处搜索了有关此问题的答案(stackover 流程),但 none 对我有用。
我的 build.gradle 代码是:--->
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
当我点击“立即同步”时,错误显示为:--->
本项目使用了AndroidX Dependencies,但是'android.useAndroidX' 属性没有启用
在此处搜索一些答案后(stackover 流程)。我从文件>新建>文件(命名为 gradle.property)创建了一个文件 'gradle.property',并在其上添加了代码:--->
org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=true
android.enableJetifier=true
执行此操作后,当我再次单击“立即同步”时。然后再次出现相同的错误(该项目使用 AndroidX 依赖项,但未启用 'android.useAndroidX' 属性。)
我不知道如何解决这个问题。
请帮忙
谢谢。
您可能已经手动迁移到 android x
尝试使用内置迁移器
https://developer.android.com/jetpack/androidx/migrate
只需右键单击,然后转到 refractor> 迁移到 AndroidX
尝试此解决方案转到:
Refactor -> Refactor this -> Migrate to Androidx -> 单击 migrate ,然后会弹出一条消息,询问你是否要通过勾选该复选框来保存项目的副本(由你决定) --> 然后重构
我已经将我的 android build.gradle 更新到最新版本,现在我收到一个错误。
我已经在此处搜索了有关此问题的答案(stackover 流程),但 none 对我有用。
我的 build.gradle 代码是:--->
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
当我点击“立即同步”时,错误显示为:--->
本项目使用了AndroidX Dependencies,但是'android.useAndroidX' 属性没有启用
在此处搜索一些答案后(stackover 流程)。我从文件>新建>文件(命名为 gradle.property)创建了一个文件 'gradle.property',并在其上添加了代码:--->
org.gradle.jvmargs=-Xmx2048m
android.useAndroidX=true
android.enableJetifier=true
执行此操作后,当我再次单击“立即同步”时。然后再次出现相同的错误(该项目使用 AndroidX 依赖项,但未启用 'android.useAndroidX' 属性。)
我不知道如何解决这个问题。
请帮忙
谢谢。
您可能已经手动迁移到 android x
尝试使用内置迁移器 https://developer.android.com/jetpack/androidx/migrate
只需右键单击,然后转到 refractor> 迁移到 AndroidX
尝试此解决方案转到:
Refactor -> Refactor this -> Migrate to Androidx -> 单击 migrate ,然后会弹出一条消息,询问你是否要通过勾选该复选框来保存项目的副本(由你决定) --> 然后重构