问题描述
我一直在尝试将片段的导航版本从 2.3.5 升级到 2.4.0-alpha03,以便它可以根据文档支持多个回栈https://developer.android.com/jetpack/androidx/releases/navigation
I have been trying to upgrade my fragment's navigation version from 2.3.5 to 2.4.0-alpha03 so that it can support multiple back stacks as per the documentation https://developer.android.com/jetpack/androidx/releases/navigation
并且还帮助保存和恢复我的每个底部导航项目的状态几天现在不成功.每次我在 build.gradle 中同步实现时,我的 homeactivity 中的代码都会抛出此错误 cannot resolve symbol
and also help in saving and restoring the state of each of my bottom nav items for a few days now unsuccessfully. Each time I sync the implementations in my build.gradle, code in my homeactivity throws this error cannot resolve symbol
以及他们的进口
也抛出错误未使用导入语句,无法解析符号
.因此,如果我运行该应用程序,它就无法执行我希望它执行的上述功能.
throw an error too unused import statement, cannot resolve symbol
. So if I run the app, it's unable to perform the above functions that I want it to.
这是我迄今为止尝试过的:
Here's what i've tried so far:
- 我添加了这个
实现androidx.navigation:navigation-fragment:2.4.0-alpha03"并实现androidx.navigation:navigation-ui:2.4.0-alpha03"
到我的build.gradle(app).
- I've added this
implementation "androidx.navigation:navigation-fragment:2.4.0-alpha03" and implementation "androidx.navigation:navigation-ui:2.4.0-alpha03"
to my build.gradle(app).
但它并没有解决.
编辑
我的 Android Gradle 插件版本是 4.0.2
My Android Gradle Plugin version is 4.0.2
我的 Gradle 版本是 6.1.1
My Gradle Version is 6.1.1
我相信有些事情我没有做对,或者我应该做的事情我没有做.如果有人能指出这一点,我将不胜感激.
I believe there's something I didn't do right or something I'm meant to do that I didn't do. Please I'd appreciate it if anyone can identify that.
这是我的具体代码:
Build.gradle(项目):
HomeActivity.java:
Activity_home.xml:
推荐答案
我也在做同样的事情 首先不要使用 2.4.0 alpha-03 因为他们有问题.
I am also working on the same thing first of all don't use 2.4.0 alpha-03 because they have a problem .
从开发者页面复制粘贴
已知问题
在使用 Gradle 6.7.0 时,由于依赖于旧版本的 Kotlin.这可以通过更新使用 Gradle 7.0 来解决.(b/190739257)
Safe Args will fail with an Unable to find method ‘’java.lang.String kotlin.text.CarsKt.titleCase(char, java.util.Locale)’’ error when using Gradle 6.7.0 due to a dependency on an older version of Kotlin. This can be worked around by updating to use Gradle 7.0. (b/190739257)
所以这将在 2.4.0 alpha04 中修复,然后使用 2.4.0 alpha02
So this will fix in 2.4.0 alpha04 till then use 2.4.0 alpha02
所以这不是实际问题尝试降级并使用最新日志更新您的问题,以便我可以帮助您
So this is not the actual problem try to downgrade and update your question with the latest logs so I can help you that
这篇关于升级我的 Fragment 的导航版本时出现问题(从 2.3.5 到 2.4.0-alpha03)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!