Use different manifest file for different flavours

Viewed 330

My app will have 2 flavors; one with <uses-feature android:name="android.hardware.camera.autofocus" /> and one without. After going through questions and answers here in SO, now I'm trying to create 2 product flavors. Here's my module.gradle

flavorDimensions "version"
    productFlavors {
        noAutoFocus {
            // Assigns this product flavor to the "version" flavor dimension.
            // This property is optional if you are using only one dimension.
            manifest.srcFile "src/noAF/AndroidManifest.xml"
            dimension "version"
            applicationIdSuffix ".noAF"
            versionNameSuffix "-noAF"
        }
        full {
            manifest.srcFile "src/main/AndroidManifest.xml"
            dimension "version"
        }
    }

I've created a noAF folder under src and copy pasted the same AndroidManifest.xml but removed the autofocus permission. But when I tried to sync my gradle project, it will give me this error

Could not get unknown property 'manifest' for ProductFlavor_Decorated{name=noAutoFocus, dimension=null, minSdkVersion=null, targetSdkVersion=null, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptSupportModeBlasEnabled=null, renderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId=null, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}, mWearAppUnbundled=null} of type com.android.build.gradle.internal.dsl.ProductFlavor.

0 Answers
Related