Android Studio Chipmunk 2021.2.1补丁1未解决的参考R

发布于 2025-02-05 10:22:28 字数 346 浏览 2 评论 0原文

更新Android Studio后,我会为单个源文件(由Android Studio生成)获得几个相同的错误:

unresolver reference R

这些错误显示在生成的文件中(包含导航资源文件中的说明)。问题在于,Android Studio在顶部生成了一个具有以下参考的文件:

import R

该引用无法正确指向App Resources。以前没有任何问题可以使用相同的代码。

我试图重建项目,使缓存无效,清除项目,重新确定PC ...无济于事。我希望有人能给我一个暗示如何解决这个问题,因为我浪费了宝贵的时间。非常感谢。

After updating Android Studio I get several identical errors for a single source file (generated by Android Studio):

unresolver reference R

The errors appear in a generated file (containing the directions from a Navigation resource file). The problem is that Android Studio generates a file with the following reference on top:

import R

And that reference is not correctly pointing to the app resources. The same code was working without any problem before.

I tried to rebuild the project, invalidate the caches, clear the project, restard the PC... all to no avail. I hope someone can give me a hint on how to fix this issue because I'm losing precious time. Many thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半﹌身腐败 2025-02-12 10:22:28

回答所有问我是否找到解决方案的人……答案是肯定的,但这并不容易。首先,我检查了所有依赖性,看来与其中的一些依赖性存在不相容性(在这种情况下有更多有意义的Erorrs真是太好了...)。我现在正在使用的软件包(解决问题后)是:

ext {

        kotlin_version = '1.6.21'
        kotlin_coroutines = '1.6.21'
        kotlin_coroutines_android_ver = '1.6.2'
        kotlin_coroutines_core_ver = '1.6.2'
        kotlin_gradle_plugin_ver = '1.6.21'
        app_compat_ver = "1.4.1"
        nav_version = "2.5.0-rc02"
        room_version="2.5.0-alpha02"
        paging_version="3.2.0-alpha01"
        desugar_ver = "1.1.5"
        fragment_ver = "1.4.1"
        recycler_view = "1.2.1"
        recycler_view_selection = "1.1.0"
        card_view_ver = "1.0.0"
        buildToolsVer = '30.0.2'
        desugar_jdk = '1.1.1'
        live_data_ver = '2.4.1'
        build_gradle_ver = '7.2.1'
        data_binding_ver = '3.1.4'
        compose_ver = '1.2.0-rc02'
        compose_tooling_ver = '1.1.1'
        activity_compose_ver = "1.5.0"
        lifec_compose_ver = "2.5.0"
        compose_appcompat_theme_ver = "0.23.1"
        work_man_version = "2.7.1"
        android_core_ver = "1.5.0"
        annotation_ver = "1.3.0"
        junit_ver = "4.12"
        core_ktx_ver = '1.8.0'
        appcompat_ver = '1.4.2'
        constraint_layout_ver = '2.1.4'
        local_broadcast_manager_ver = "1.1.0"
        paging_compose_version = '1.0.0-alpha15'
        sqlite_ktx_ver = "2.2.0"
        lifecycle_runtime_ktx_ver = "2.5.0-alpha02"
        okhttp3_logging_interceptor_ver = "5.0.0-alpha.9"
        room_paging = "2.5.0-alpha02"
        retrofit_ver = "2.9.0"
        android_material_ver = "1.6.1"
        lifecycle_extensions_ver = "2.2.0"
        glide_version = "4.13.2"
    }

删除项目并再次从git中获取并以上面的配置来更新软件包。某些软件包的版本(例如,Kotlin插件和语言)不是最新的,这是因为我实现了Jatpack组成,该组合与最新版本的Kotlin不起作用。

希望这会帮助别人

To answer to all those who asked me if I found a solution... the answer is yes, but it wasn't easy. First of all I checked all dependecies and it looks like there was a problem of incompatibility with some of them (it would be nice to have more meaningfull erorrs in that case...). The packages that I'm using now (after fixing the problem) are:

ext {

        kotlin_version = '1.6.21'
        kotlin_coroutines = '1.6.21'
        kotlin_coroutines_android_ver = '1.6.2'
        kotlin_coroutines_core_ver = '1.6.2'
        kotlin_gradle_plugin_ver = '1.6.21'
        app_compat_ver = "1.4.1"
        nav_version = "2.5.0-rc02"
        room_version="2.5.0-alpha02"
        paging_version="3.2.0-alpha01"
        desugar_ver = "1.1.5"
        fragment_ver = "1.4.1"
        recycler_view = "1.2.1"
        recycler_view_selection = "1.1.0"
        card_view_ver = "1.0.0"
        buildToolsVer = '30.0.2'
        desugar_jdk = '1.1.1'
        live_data_ver = '2.4.1'
        build_gradle_ver = '7.2.1'
        data_binding_ver = '3.1.4'
        compose_ver = '1.2.0-rc02'
        compose_tooling_ver = '1.1.1'
        activity_compose_ver = "1.5.0"
        lifec_compose_ver = "2.5.0"
        compose_appcompat_theme_ver = "0.23.1"
        work_man_version = "2.7.1"
        android_core_ver = "1.5.0"
        annotation_ver = "1.3.0"
        junit_ver = "4.12"
        core_ktx_ver = '1.8.0'
        appcompat_ver = '1.4.2'
        constraint_layout_ver = '2.1.4'
        local_broadcast_manager_ver = "1.1.0"
        paging_compose_version = '1.0.0-alpha15'
        sqlite_ktx_ver = "2.2.0"
        lifecycle_runtime_ktx_ver = "2.5.0-alpha02"
        okhttp3_logging_interceptor_ver = "5.0.0-alpha.9"
        room_paging = "2.5.0-alpha02"
        retrofit_ver = "2.9.0"
        android_material_ver = "1.6.1"
        lifecycle_extensions_ver = "2.2.0"
        glide_version = "4.13.2"
    }

After deleting the project and fetching it once again from Git and updating the packages with the configuration above it worked. The version of some packages (for example, Kotlin PlugIn and Language) are not the latest and that is because I implemented Jatpack Compose which doesn't work with the latest version of Kotlin.

Hope this will help others

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文