The error is as follows
Configuration `debugRuntimeClasspath` contains AndroidX dependencies, but the `android.useAndroidX` property is not enabled, which may cause runtime issues.
Set `android.useAndroidX=true` in the `gradle.properties` file and retry.
The following AndroidX dependencies are detected:
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.annotation:annotation:1.3.0
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.core:core:1.7.0
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.fragment:fragment:1.3.6 -> androidx.annotation:annotation-experimental:1.1.0
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.lifecycle:lifecycle-runtime:2.4.0
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.fragment:fragment:1.3.6 -> androidx.loader:loader:1.0.0 -> androidx.lifecycle:lifecycle-livedata:2.0.0 -> androidx.arch.core:core-runtime:2.1.0
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.savedstate:savedstate:1.1.0 -> androidx.arch.core:core-common:2.1.0
debugRuntimeClasspath -> androidx.appcompat:appcompat:1.4.2 -> androidx.savedstate:savedstate:1.1.0 -> androidx.lifecycle:lifecycle-common:2.4.0
problem causes:
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled:
This shows that the project uses AndroidX dependencies, but it is not enabled in the gradle.properties file.
Solution:
You need to add the following two sentences to the gradle.properties file
android.useAndroidX=true android.enableJetifier=true
Question 2
Manifest merger failed : android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined.
When targetSdkVersion is greater than or equal to SDK 31 (that is, Android 12), if some activities are configured with Intent-filter, the exported attribute must also be configured at the same time, otherwise the compilation will fail.
Solution
- Lower targetSdkVersion to 30.
- Add the Activity with Intent-filter configured in the Manifest
android:exported属性