It is not possible to reconfigure gradle under new requirements.
I updated the gradle plugin and broke the build system for different assemblies.
There were: 1) three folders were made in src
src/mainwith shared filessrc/stagingEnvironmentwithsrc/stagingEnvironmentfiles, including a manifestsrc/productionEnvironmentwith files for sale, including the manifest
2) in app/gradle
2.1) setting up resources:
sourceSets { main { java.srcDirs = ['src/main/java'] res.srcDirs = ['src/main/res'] assets.srcDirs = ['src/main/assets'] } stagingEnvironment { java.srcDirs = ['src/stagingEnvironment/java'] res.srcDirs = ['src/stagingEnvironment/res'] manifest.srcFile manifestStagingPath jniLibs.srcDir jniLibsPath } productionEnvironment { java.srcDirs = ['src/productionEnvironment/java'] res.srcDirs = ['src/productionEnvironment/res'] manifest.srcFile manifestProductionPath jniLibs.srcDir jniLibsPath } } 2.2) customize flavors:
productFlavors { stagingEnvironment { applicationId 'com.example' versionCode Integer.valueOf(StagingVersionCode) versionName StagingVersionName } productionEnvironment { applicationId 'com.example' versionCode Integer.valueOf(ProductionVersionCode) versionName ProductionVersionName } } 2.3) customize build types
buildTypes { debug { minifyEnabled false } release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), defProguardFiles } } Accordingly, I saw in the selection options panel
- stagingEnvironmentDebug
- stagingEnvironmentRelease
- productionEnvironmentDebug
- productionEnvironmentRelease
===================================
After updating the plug-in, the error Error:All flavors must now belong to a named flavor dimension. appeared Error:All flavors must now belong to a named flavor dimension. By analogy with the documentation, I added flavorDimensions "dev", "prod" and in the blocks of flores these names:
productFlavors { stagingEnvironment { applicationId 'com.example' versionCode Integer.valueOf(StagingVersionCode) versionName StagingVersionName dimension 'dev' } productionEnvironment { applicationId 'com.example' versionCode Integer.valueOf(ProductionVersionCode) versionName ProductionVersionName dimension 'prod' } } Problem 1: now in the selection panel of the selection cases there are only two options for the “squeezed” stagingEnvironmentProductionEnvironmentDebug stagingEnvironmentProductionEnvironmentRelease - how to prevent them from merging between?
Problem 2: (probably follows from the first) - when trying to build, it writes Manifest merger failed with multiple errors, see logs