NativeScript / NativeScript/nativescript-cli

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

Open
#3,670 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug build os: android
Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

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

Contributor guide

Open the contributing guide

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.

Research direction

Reproduce the failure with a hello-world project using CLI 4.1.0 and a custom App_Resources/Android/src/main/res/values/strings.xml. Inspect how Android resources are assembled during the build and verify that the generated app_name and title_activity_kimera strings remain available alongside the custom string. Done means the project builds successfully with the custom resource file.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
build-system, cli, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.