eyal-lezmy / SharedResourceBug

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The problem

This sample shows a problem with Android Studio and nav component, there are 3 modules: app (root), feature1 and feature2.

There is no clean way to have access to the classes generated by the androidx.navigation.safeargs.kotlin gradle plugin.

To make them accessible to all our module we decided to put the navigation graph in the app module, in a dedicated resource folder (sharedRes) and to add this folder to all the other source set by adding this line to each module:

android.sourceSets.main.res.srcDirs += "$rootDir/app/src/main/sharedRes"

This make sure all the modules can access the SafeArgs api.

The problem here is that the SharedRes/app/src/main/sharedRes/navigation/navigation_main.xml file is designated by the IDE as part of the feature2 module. When we open the file, the feature1's components are not found.

Reproduced on AS 3.3.2 and 3.4 RC 2

About


Languages

Language:Kotlin 100.0%