Adding strings.xml in App_Resources/Android/src/main/res/values is crashing the build
See original GitHub issueBy 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
andapp_name
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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: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?
Just experienced this when I created a
strings.xml
that only had the app_name declared. The build failed becausetitle_activity_kimera
couldn’t be found. After reverting my changes the build still failed though, so I just removed thelabel
attribute fromactivity
to fix.