Skip to content

Conversation

@souvlakias
Copy link
Contributor

@souvlakias souvlakias commented Jan 8, 2026

This makes the Jetcaster.wear sample functional (Repo)
Closes #6544

Collects the assets directory from dependencies and passes them to aapt2 link

@souvlakias souvlakias force-pushed the android-collect-assets branch from 562ac2b to 30213b2 Compare January 9, 2026 08:56

override def androidVirtualDevice = super.androidVirtualDevice().withName("java-test")
override def androidVirtualDevice = super.androidVirtualDevice().withName("java-r8-test")
override def androidEmulatorPort = "5556"
Copy link
Member

Choose a reason for hiding this comment

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

Since #6486, we should be able to use build.example.testPort or PORT env variable.

mill/example/package.mill

Lines 255 to 262 in bc6f01a

/**
* Unique port for this example test module.
* Each module claims a port by incrementing the shared counter.
* This ensures each example test gets a distinct port for parallel execution.
*/
val testPort: Int = portCounter.getAndIncrement()
def forkEnv = Map("LANG" -> "C", "PORT" -> testPort.toString)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The caveat with build.example.testPorts logic, is that android emulators require an even port number between a certain range, in order to be visible to adb (https://developer.android.com/studio/run/emulator-commandline#common)

Note that if the port value is not even and is in the range 5554 to 5584, the virtual device will start but not be visible when you use the adb devices command, if the adb server starts after the emulator. For this reason, we recommend using an even console port number.

Copy link
Contributor

Choose a reason for hiding this comment

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

@souvlakias we can customise the testPort to follow the even port logic I think

Copy link
Contributor

@vaslabs vaslabs Jan 11, 2026

Choose a reason for hiding this comment

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

try editing this

trait ExampleCrossModuleAndroid extends ExampleCrossModule {

Copy link
Member

@lefou lefou Jan 11, 2026

Choose a reason for hiding this comment

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

Does that really say the ports must be between 5554 and 5584? I'm not a native English speaker, so hard to tell, but it sound like it's just a suggestion to reduce impact by other assumptions.

For the even port number, you could acquire ports consecutively (run testPort repeatedly), until you get an even number, and then run it once more, to ensure the port + 1 is also reserved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC it is a suggestion yes, to catch the case of the adb server being started after the emulator. Thus, it does concern us since the adb server will run the first time we run any adb command which in our cases, happens after the calls of avd and emulator

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 also add this explanation and the link to the emulator port method

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.

Android: Support assets collection

3 participants