youth5201314/banner

缺少android.useAndroidX=true配置以及 AndroidManifest 缺少 android:exported="true", 编译失败

Opened this issue · 0 comments

  1. 因为缺少 android.useAndroidX=true 的 配置导致编译失败,出现如下的编译错误。
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
* What went wrong:
Execution failed for task ':banner:generateDebugRFile'.
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.viewpager2:viewpager2:1.1.0-beta02 
  1. 因为 AndroidManifest.xml 的 Activity 缺少 android:exported="true",导致编译失败。出现了如下编译错误日志
Manifest merger failed : android:exported needs to be explicitly specified for element <activity#com.spring.usekotlin.MainActivity>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

建议添加上这两个配置代码。