Configure Gradle task dependencies to be architecture-specific

Open
#112 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
android

Research direction

Start with the Gradle configuration that defines the architecture targets and task dependencies, then review how Android Studio selects an architecture when launching on a device or emulator. Done means development runs compile only the architecture being targeted while preserving builds for arm, arm64, x86, and x86_64.

Written by the indexing model from the issue text.

Description

I'm building a library which I'd like to make available on every possible platform: arm, arm64, x86, x86_64. However, during development I usually care about a single one. But gradle compiles everything, which takes some extra time.

One option is to manually disable the archs which I don't care about. I can do that by commenting out the undesired archs. Like so:

    targets = [
    //        "arm",
            "arm64",
    //        "x86",
    //        "x86_64"
    ]

But that's inconvenient because (1) the gradle file is checked into the version control system and (2) I need to remember to change this if I change de development device (e.g. I transition from a physical device to an emulator).

I'm wondering if there's a recommended way during development to tell gradle to only compile the right arch for the device we are targeting when we launch the app using the "run" button. I think Android Studio handles this gracefully for regular JNI/C++ code using CMake in Android Studio.

Dominant language
Kotlin
Stars
1.3k
Forks
95
Avg merge
15m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/rust-android-gradle

All issues in mozilla/rust-android-gradle

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.