NativeScript / NativeScript/nativescript-cli

Multiple flavors in Android project: no way to specify which APK to run after build

未關閉
#3,538 3 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

feature os: android run
主要語言
JavaScript
星號
1.1k
分支
204
平均合併
1 天 9 小時
30 天內合併 PR
8

描述

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.

https://github.com/NativeScript/nativescript-cli/blob/8cd21b8f437eb37c14d0bd1df9babce7f53d7ee9/lib/services/platform-service.ts#L800

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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 lib/services/platform-service.ts 中連結的 APK 選擇邏輯附近開始,檢查 tns run android 如何處理由 app.gradle flavors 產生的多個 APK。定義 CLI 選項及其預期的 flavor 或 APK 選擇行為,然後驗證 tns run android 一致地啟動所要求的 APK,而不是依賴建置順序。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
android, javascript
領域
cli, mobile
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。