Skip to content

Conversation

@souvlakias
Copy link
Contributor

@souvlakias souvlakias commented Nov 26, 2025

Addresses #6237

This is a temporary fix for the resource linking until we properly pass submodules' resources to other modules.

Changes

  • Set the --non-final-ids flag in aapt2 link call for non-app modules
  • Pass moduleDeps' namespaces as --extra-packages to aapt
  • Pickup all java files from androidLinkedResources instead of only R.java

"--debug-mode"
)

// Add module dependencies' namespaces as extra packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a TODO here to clean up, once we rewire the submodule sources to go to the app module

> ./mill show app.test
...compiling 1 Java source...
...compiling 2 Java sources to out/app/test/compile.dest/classes...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intended to match for the compile task and should have failed when we defaulted BuildConfig to true in #6145 as a second source was being added, but it coincidentaly matched with the androidCompiledRClasses

compiling 1 Java sources to out/app/test/androidCompiledRClasses.dest/classes

Now we explicitly match for the compile task

@souvlakias souvlakias marked this pull request as ready for review November 28, 2025 15:22
@vaslabs
Copy link
Contributor

vaslabs commented Nov 30, 2025

the androidtodo does not seem to be working with the changes

8106]   Test com.example.android.architecture.blueprints.todoapp.taskdetail.TaskDetailViewModelTest.activateTask 
failed: java.lang.NoClassDefFoundError: com/example/android/architecture/blueprints/todoapp/R$string, took 0.072 sec

@vaslabs
Copy link
Contributor

vaslabs commented Nov 30, 2025

pokemon multimodule is also complaining:

Error: Missing class com.nicos.compose_ui.R$color (referenced from: int com.nicos.compose_ui.utils.extensions.ExtensionsKt.colorToInt$default(android.graphics.drawable.Drawable, android.content.Context, int, int, java.lang.Object))
599] Missing class com.nicos.compose_ui.R$drawable (referenced from: kotlin.Unit com.nicos.compose_ui.components.ToolbarKt.CustomToolbar_3IgeMak$lambda$8(kotlin.jvm.functions.Function0, androidx.compose.runtime.Composer, int))
599] Missing class com.nicos.compose_ui.R$string (referenced from: kotlin.Unit com.nicos.compose_ui.components.ComposableSingletons$GenericViewsKt.lambda__515675410$lambda$0(androidx.compose.foundation.layout.RowScope, androidx.compose.runtime.Composer, int) and 4 other contexts)
599] Missing class com.nicos.network.R$string (referenced from: java.lang.String com.nicos.network.generic_classes.HandlingError.handleErrorMessage(java.lang.Throwa

@vaslabs
Copy link
Contributor

vaslabs commented Nov 30, 2025

I think we need transitive modules instead


// Add module dependencies' namespaces as extra packages
// TODO: cleanup once we properly pass resources from dependencies
val extraPackages = moduleDeps.collect {
Copy link
Contributor

@vaslabs vaslabs Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe here we need transitive modules.

Also for better customisation , we can make this into a task.

androidAaptLinkExtraPackages

@souvlakias souvlakias marked this pull request as draft November 30, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants