Android Jetpack Compose 导航中的依赖性问题
Dependency issues in navigation with Android Jetpack Compose
我正在探索 the docs 中指定的组合导航。
添加文档中指定的版本 2.4.0-alpha07
的依赖项,出现以下错误,
错误 1
One or more issues found when checking AAR metadata values:
The minCompileSdk (31) specified in a dependency's AAR metadata
(META-INF/com/android/build/gradle/aar-metadata.properties) is greater
than this module's compileSdkVersion (android-30). Dependency:
androidx.navigation:navigation-compose:2.4.0-alpha07. AAR metadata
file:
/Users/abhimanyu/.gradle/caches/transforms-3/0575ff5712e0a9c15b8d7424501c07b8/transformed/jetified-navigation-compose-2.4.0-alpha07/META-INF/com/android/build/gradle/aar-metadata.properties.
此错误迫使我将应用程序的 compileSdkVersion
和 targetSdkVersion
从 30 升级到 31。
升级版本报错,
错误 2
Manifest merger failed: 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.
要解决这个问题,请检查 。
即使在添加 android:exported
之后,我仍然遇到相同的错误(错误 2)。
compileSdkVersion
升级到 31 是强制性的吗?
如果是,错误2如何解决。如果不是,错误1如何解决?
如果可能的话,我个人更喜欢坚持使用 SDK 30。
现在发布的每个 AndroidX 库都是用 API 31.
编译的
您也可以在 Accompanist release notes:
中查看
Accompanist is now built against SDK 31:
This means that your apps also need to compile against SDK 31. This was necessitated by the latest AndroidX releases also being built against SDK 31.
只需在您的build.gradle
中使用
compileSdkVersion 31
但您应该始终使用最新的 SDK 进行编译,因为它不会改变您的应用行为。
这与您的targetSdkVersion
无关,您可以根据需要继续设置。
唯一的规则是:
minSdkVersion <= targetSdkVersion <= compileSdkVersion
doc 中有更多详细信息。
我正在探索 the docs 中指定的组合导航。
添加文档中指定的版本 2.4.0-alpha07
的依赖项,出现以下错误,
错误 1
One or more issues found when checking AAR metadata values:
The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.navigation:navigation-compose:2.4.0-alpha07. AAR metadata file: /Users/abhimanyu/.gradle/caches/transforms-3/0575ff5712e0a9c15b8d7424501c07b8/transformed/jetified-navigation-compose-2.4.0-alpha07/META-INF/com/android/build/gradle/aar-metadata.properties.
此错误迫使我将应用程序的 compileSdkVersion
和 targetSdkVersion
从 30 升级到 31。
升级版本报错,
错误 2
Manifest merger failed: 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.
要解决这个问题,请检查
即使在添加 android:exported
之后,我仍然遇到相同的错误(错误 2)。
compileSdkVersion
升级到 31 是强制性的吗?
如果是,错误2如何解决。如果不是,错误1如何解决?
如果可能的话,我个人更喜欢坚持使用 SDK 30。
现在发布的每个 AndroidX 库都是用 API 31.
编译的您也可以在 Accompanist release notes:
中查看Accompanist is now built against SDK 31: This means that your apps also need to compile against SDK 31. This was necessitated by the latest AndroidX releases also being built against SDK 31.
只需在您的build.gradle
compileSdkVersion 31
但您应该始终使用最新的 SDK 进行编译,因为它不会改变您的应用行为。
这与您的targetSdkVersion
无关,您可以根据需要继续设置。
唯一的规则是:
minSdkVersion <= targetSdkVersion <= compileSdkVersion
doc 中有更多详细信息。