Java Code Examples for com.android.builder.model.ProductFlavor#getTargetSdkVersion()

The following examples show how to use com.android.builder.model.ProductFlavor#getTargetSdkVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LintGradleProject.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@Override
@NonNull
public AndroidVersion getTargetSdkVersion() {
    if (mTargetSdkVersion == null) {
        ApiVersion targetSdk = mVariant.getMergedFlavor().getTargetSdkVersion();
        if (targetSdk == null) {
            ProductFlavor flavor = mProject.getDefaultConfig().getProductFlavor();
            targetSdk = flavor.getTargetSdkVersion();
        }
        if (targetSdk != null) {
            mTargetSdkVersion = LintUtils.convertVersion(targetSdk, mClient.getTargets());
        } else {
            mTargetSdkVersion = super.getTargetSdkVersion(); // from manifest
        }
    }

    return mTargetSdkVersion;
}
 
Example 2
Source File: ProcessManifest.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private String getTargetSdkVersion(AndroidBuilder androidBuilder, ProductFlavor mergedFlavor, ProcessManifest processManifest) {
    if (androidBuilder.isPreviewTarget()) {
        return androidBuilder.getTargetCodename();
    }

    final ApiVersion version = mergedFlavor.getTargetSdkVersion();
    return (version == null ? null : version.getApiString());
}
 
Example 3
Source File: DefaultProductFlavor.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Clone a given product flavor.
 *
 * @param productFlavor the flavor to clone.
 *
 * @return a new instance that is a clone of the flavor.
 */
@NonNull
static ProductFlavor clone(@NonNull ProductFlavor productFlavor) {
    DefaultProductFlavor flavor = new DefaultProductFlavor(productFlavor.getName());
    flavor._initWith(productFlavor);
    flavor.mDimension = productFlavor.getDimension();
    flavor.mMinSdkVersion = productFlavor.getMinSdkVersion();
    flavor.mTargetSdkVersion = productFlavor.getTargetSdkVersion();
    flavor.mMaxSdkVersion = productFlavor.getMaxSdkVersion();

    flavor.mVersionCode = productFlavor.getVersionCode();
    flavor.mVersionName = productFlavor.getVersionName();

    flavor.mApplicationId = productFlavor.getApplicationId();


    flavor.mSigningConfig = productFlavor.getSigningConfig();

    flavor.addResourceConfigurations(productFlavor.getResourceConfigurations());
    flavor.addManifestPlaceholders(productFlavor.getManifestPlaceholders());

    flavor.addResValues(productFlavor.getResValues());
    flavor.addBuildConfigFields(productFlavor.getBuildConfigFields());

    flavor.setMultiDexEnabled(productFlavor.getMultiDexEnabled());

    flavor.setMultiDexKeepFile(productFlavor.getMultiDexKeepFile());
    flavor.setMultiDexKeepProguard(productFlavor.getMultiDexKeepProguard());
    flavor.setJarJarRuleFiles(ImmutableList.copyOf(productFlavor.getJarJarRuleFiles()));

    return flavor;
}