r/androiddev • • 5m ago

Discussion I built a Gradle plugin to catch Android layout issues that can break on tablets and foldables

1 Upvotes

One thing I've been thinking about while working on Android projects is how easily layouts that look perfectly fine on a phone can break when the app runs on a tablet, foldable, or in resizable multi-window mode.

Some examples:

- A Compose screen using "Modifier.fillMaxWidth().height(600.dp)" that doesn't adapt to available space.

- "requiredSize()" forcing dimensions beyond the available constraints.

- XML layouts with oversized fixed dimensions.

- Activities with orientation restrictions that prevent flexible resizing.

These aren't necessarily bugs on a typical phone configuration, but they can become real usability issues on larger or resizable screens.

I wanted to explore whether some of these patterns could be caught automatically during development, rather than discovering them through manual testing.

So I built ViewLint, an open-source Gradle plugin for static analysis of Android adaptive-layout risks.

A few things it currently checks:

1. Jetpack Compose

- Fixed "width()", "height()", and "size()" modifier usage.

- Missing adaptive handling in relevant modifier chains.

- "requiredSize()" overrides.

2. XML layouts

- Fixed root dimensions.

- Large fixed inner dimensions.

- Deprecated "AbsoluteLayout" usage.

3. AndroidManifest.xml

- Activity "screenOrientation" restrictions.

- "maxAspectRatio" constraints.

4. CI integration

- HTML reports that work offline.

- JSON and SARIF 2.1.0 output.

- Baseline support for existing issues.

- "failOn = "NEW"" to prevent newly introduced findings from passing CI.

The goal isn't to claim that every fixed dimension is a bug. Fixed dimensions can be perfectly intentional. Static analysis can identify suspicious patterns, but developers still need to evaluate the context.

Quick start:

plugins {

id("io.github.dev-vikas-soni.viewlint") version "1.0.0"

}

Run:

./gradlew viewlint

I'm the developer behind this project, and I'd particularly appreciate technical feedback on the rule design.

A few things I'm interested in discussing:

- How do you distinguish intentional fixed dimensions from actual adaptive-layout problems?

- Which Compose patterns should be considered before reporting a fixed dimension?

- Are there important foldable/tablet compatibility issues that static analysis could catch but usually doesn't?

Source code: https://github.com/dev-vikas-soni/viewlint

I'm interested in improving the accuracy of these checks, especially avoiding false positives in real-world Android projects.


r/androiddev • • 14h ago

Rayo: I made a new E2E test suite, open-source with integrated mocking and more

0 Upvotes

Hey android dev, I made rayo and I think is useful enough that warrants sharing it.

I love Maestro but from my experience at work, e2e are much more than just running some steps. You need to have fast execution, easy install of the testing tooling, clear reporting of the e2e errors and if you want to mock them everything get complicated really fast.

That's why I've been thinking of creating a tool that covers these pain points and more, a CLI tool that is a single binary.

- Is fast: it detects changes smartly (on average my test went 2x as fast minimum in rayo vs maestro)

- Runs most Maestro flows as is (so basically no migration changes)

- Backend, GPS and camera mocking built in (useful for maps, and stateful apps)

- Records mocks from your real API (you no longer need a external tool)

- Clear failure reports: the step, the cause, and the screen (it will make screenshot, create state dumps, etc so you can check it later, very useful on the CI)

- Retries, flaky detection, JUnit reports (even my perfect e2e test failed so I just gave up and added retries and good reporting for them)

- One small binary, only needs adb as dependency (this is my favourite fact: only one binary, so no need to setup anything, it just works)

Check please, any feedback is welcomed :)

Repo: https://github.com/nanihadesuka/rayo

Docs: https://nanihadesuka.github.io/rayo/


r/androiddev • • 19h ago

Question Does anyone use browser-based emulators for sharing builds?

0 Upvotes

Has anyone used something like Appetize to share builds with designers or PMs? Distributing test builds with PR changes efficiently has always been an issue for us.