1

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.

Sergiob
  • 838
  • 1
  • 13
  • 28

1 Answers1

1

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

Sergiob
  • 838
  • 1
  • 13
  • 28