简体   繁体   中英

Unable to reference strings added under a new build variant in Android

I created a new build variant called "myVariant". I want to add translated strings only under the new variant. So, I created a folder called "myVariant" under app/src/ and added translated resources under app/src/myVariant/res/values-fr and app/src/myVariant/res/values-de folders.

When I rename a string resource ID in the default strings.xml , Android studio does not rename the string resource ID in any of the translated files. When I click on a string resource ID in any of the translated files and find usages, it is not able to find any references.

When I click on R.string.xyz in Android studio, shouldn't it give me multiple implementations of strings.xml for the default and the translated files? Is it because I created it under a different build variant and it is not under main ? Anyone seen this before? Any help will be appreciated! Thank you :)

That was easy. Just switch the build variant in Android studio to "myVariant" and everything works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM