NativeScript / NativeScript/nativescript-cli
Multiple flavors in Android project: no way to specify which APK to run after build
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 204
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 8
Description
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
yes.
Tell us about the problem
When specifying multiple flavors in the app.gradle and thus more than one APK gets generated during build, the CLI prints a warning More than one .apk found in ... directory. Using the last one produced from build.
So depending on Gradle's internal workings when doing a tns run android the APK that was built first is picked. Which may not be the right one in this case.
Would be great if the CLI would have an option to specify which flavor (or APK) to be used on tns run
Which platform(s) does your issue occur on?
macOS, Android build
Please provide the following version numbers that your issue occurs with:
- CLI: 4.0.0
- Cross-platform modules: tns-core-modules 4.0.1
- Runtime(s): tns-androd 4.0.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/services/platform-service.ts around the linked APK-selection logic and review how tns run android handles multiple APKs produced from app.gradle flavors. Define the CLI option and its expected flavor or APK selection behavior, then verify that tns run android consistently launches the requested APK instead of relying on build order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- cli, mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100