question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
rosen-vladimirovcommented, Jun 6, 2018

@NickIliev when you place anything in the <project dir>/app/App_Resources/Android/src/main/res it automatically replaces the default resource that would have been used for the build. This is by design and allows the user to fully override the resource. I agree that the current case leads to unexpected errors during build, but it can be easily fixed by adding the following lines in your strings.xml:

<string name="app_name">__NAME__</string>
<string name="title_activity_kimera">__TITLE_ACTIVITY__</string>

NOTE: CLI will replace these placeholders directly in your <project dir>/platforms/android once it builds the application.

Can you give it a try and inform us if it works for you?

3reactions
mudlabscommented, Apr 4, 2019

Just experienced this when I created a strings.xml that only had the app_name declared. The build failed because title_activity_kimera couldn’t be found. After reverting my changes the build still failed though, so I just removed the label attribute from activity to fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android strings.xml apostrophe, date, and string crash
@Vadik, I have added some logcat info. Maybe it's due to the date format after that apostrophe since I'm getting that error? Something's...
Read more >
String resources | Android Developers
A string resource provides text strings for your application with optional text ... String: XML resource that provides a single string.
Read more >
TextView and strings.xml: Android Programming - YouTube
Builds on video: https://www.youtube.com/watch?v=aE5f1... 1. Add a TextView, move text to strings. xml, change formatting. 2.
Read more >
Android strings.xml — things to remember | by Dmytro Danylyk
Adding screen name prefix to every string helps to immediately recognize screen which current ... If you want you can create strings.xml file...
Read more >
core/res/res/values/strings.xml - platform/frameworks/base
Format string used to add a suffix like "B" to a number. to display a size in bytes. ... <string name="roamingText4">Out of Building</string>....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found