Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Gradle merge string resources
    text
    copied!<p>I would like to create 2 different APKs (release and debug) using Gradle and I want to use different names for them ('appName' and 'appName debug'). </p> <p>I've found some solutions but it doesn't work for me:<br> <a href="https://plus.google.com/118417777153109946393/posts/Dk65EACXqsh" rel="nofollow">link 1</a><br> <a href="https://plus.google.com/118417777153109946393/posts/EATUmhntaCQ" rel="nofollow">link 2</a></p> <p>I would like to install both apks on the device but I have the following error:</p> <pre><code> Duplicate resources: ...\src\release\res\values\config.xml:string/config_app_name, ...\src\main\res\values\config.xml:string/config_app_name </code></pre> <p>If I delete the <code>config_app_name</code> key from the <code>main\res\values\config.xml</code> then Gradle says the the key was not found.</p> <p>I have 3 manifest files:</p> <pre><code>...\src\main\AndroidManifest.xml (this uses the `android:label="@string/config_app_name"`) ...\src\release\AndroidManifest.xml ...\src\debug\AndroidManifest.xml buildTypes { debug { packageNameSuffix ".debug" versionNameSuffix "-debug" buildConfig "public static final String PROVIDER_AUTHORITY = \"" + PROVIDER_DEBUG + "\";" signingConfig signingConfigs.debug } release { buildConfig "public static final String PROVIDER_AUTHORITY = \"" + PROVIDER_RELEASE + "\";" signingConfig signingConfigs.release } } sourceSets { debug { java.srcDirs = [ 'src/main/java'] res.srcDirs = [ 'src/main/res', 'src/debug/res'] } release { java.srcDirs = [ 'src/main/java'] res.srcDirs = [ 'src/main/res', 'src/release/res'] } } </code></pre> <p>Is it possible to use one common key (strings, integers, dimens) in the main part of the project and override it in the release/debug part?</p> <p>Thanks in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload