NativeScript / NativeScript/nativescript-cli

Adding strings.xml in App_Resources/Android/src/main/res/values is crashing the build

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

還沒有人認領這個 Issue。

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

描述

By the design with CLI 4.1.0 the structure of Android resource folder is as follows:

Android/src/main/res/values

By default in values folder there is colors.xml and styles.xml files.
When, I add a strings/xml file it will cause the app build to crash.
The reaons: the strings.xml is created during build and if a custom file is introduced it will replace the content of the default one causing two string to be missing (whic are used in AndoridManifes)

Error log

D:\git\NS-Issues-2018-II\NativeScript\issue-5897\platforms\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:33: AAPT: error: resource string/app_name (aka org.nativescript.issue5897:string/app_name) not found.

D:\git\NS-Issues-2018-II\NativeScript\issue-5897\platforms\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml:44: AAPT: error: resource string/title_activity_kimera (aka org.nativescript.issue5897:string/title_activity_kimera) not found.

Reproducible with hello world template and CLI 4.1.0 on Win.

Steps to reporduce:

  • Create new project
  • Add strings.xml in Android/src/main/res/values
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="nativescript_google_maps_api_key">Some-Api-Key</string>
</resources>
  • Build the project - it fails due to missing title_activity_kimera and app_name

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

使用 CLI 4.1.0 和自訂的 App_Resources/Android/src/main/res/values/strings.xml,在 hello-world 專案中重現此失敗。檢查 Android 資源在建置期間的組裝方式,並確認產生的 app_name 和 title_activity_kimera 字串仍可與自訂字串一起使用。當專案使用自訂資源檔成功建置時,即表示完成。

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

評估

技術堆疊
android, javascript
領域
build-system, cli, mobile-dev
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

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

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