我在构建我的 Android 应用时遇到了以下错误:
任务 :app:mergeDebugResources FAILED
构建失败并出现异常。
问题出在哪里: 执行任务“:app:mergeDebugResources”时出错。
解决方法如下:
此项目使用 AndroidX 依赖项,但未启用“android.useAndroidX”属性。请在 gradle.properties 文件中将此属性设置为 true,然后重试。检测到以下AndroidX依赖关系:androidx.versionedparcelable:versionedparcelable:1.0.0,androidx.slidingpanelayout:slidingpanelayout:1.0.0,androidx.fragment:fragment:1.0.0,androidx.core:core:1.0.0,androidx.customview:customview:1.0.0,androidx.swiperefreshlayout:swiperefreshlayout:1.0.0,androidx.interpolator:interpolator:1.0.0,androidx.loader:loader:1.0.0,androidx.drawerlayout:drawerlayout:1.0.0,androidx.viewpager:viewpager:1.0.0,androidx.collection:collection:1.0.0,androidx.localbroadcastmanager:localbroadcastmanager:1.0.0,androidx.lifecycle:lifecycle-common:2.0.0,androidx.arch.core:core-common:2.0.0,androidx.annotation:annotation:1.0.0,androidx.lifecycle:lifecycle-livedata:2.0.0,androidx.legacy:legacy-support-core-ui:1.0.0,androidx.lifecycle:lifecycle-viewmodel:2.0.0,androidx.lifecycle:lifecycle-livedata-core:2.0.0,androidx.legacy:legacy-support-v4:1.0.0,androidx.media:media:1.0.0,androidx.arch.core:core-runtime:2.0.0,androidx.legacy:legacy-support-core-utils:1.0.0,androidx.documentfile:documentfile:1.0.0,androidx.cursoradapter:cursoradapter:1.0.0,androidx.lifecycle:lifecycle-runtime:2.0.0,androidx.coordinatorlayout:coordinatorlayout:1.0.0,androidx.asynclayoutinflater:asynclayoutinflater:1.0.0,androidx.print:print:1.0.0
任务 :app:mergeDebugResources FAILED
构建失败并出现异常。
问题出在哪里: 执行任务“:app:mergeDebugResources”时出错。
解决方法如下:
此项目使用 AndroidX 依赖项,但未启用“android.useAndroidX”属性。请在 gradle.properties 文件中将此属性设置为 true,然后重试。检测到以下AndroidX依赖关系:androidx.versionedparcelable:versionedparcelable:1.0.0,androidx.slidingpanelayout:slidingpanelayout:1.0.0,androidx.fragment:fragment:1.0.0,androidx.core:core:1.0.0,androidx.customview:customview:1.0.0,androidx.swiperefreshlayout:swiperefreshlayout:1.0.0,androidx.interpolator:interpolator:1.0.0,androidx.loader:loader:1.0.0,androidx.drawerlayout:drawerlayout:1.0.0,androidx.viewpager:viewpager:1.0.0,androidx.collection:collection:1.0.0,androidx.localbroadcastmanager:localbroadcastmanager:1.0.0,androidx.lifecycle:lifecycle-common:2.0.0,androidx.arch.core:core-common:2.0.0,androidx.annotation:annotation:1.0.0,androidx.lifecycle:lifecycle-livedata:2.0.0,androidx.legacy:legacy-support-core-ui:1.0.0,androidx.lifecycle:lifecycle-viewmodel:2.0.0,androidx.lifecycle:lifecycle-livedata-core:2.0.0,androidx.legacy:legacy-support-v4:1.0.0,androidx.media:media:1.0.0,androidx.arch.core:core-runtime:2.0.0,androidx.legacy:legacy-support-core-utils:1.0.0,androidx.documentfile:documentfile:1.0.0,androidx.cursoradapter:cursoradapter:1.0.0,androidx.lifecycle:lifecycle-runtime:2.0.0,androidx.coordinatorlayout:coordinatorlayout:1.0.0,androidx.asynclayoutinflater:asynclayoutinflater:1.0.0,androidx.print:print:1.0.0
我修改了项目的gradle.properties文件,并将"android.userAndroidX"设置为true。但每次尝试重新构建时,它都会自动返回false。
gradle.properties 在构建过程中是否会被其他任务覆盖?谢谢!