在gradle中配置umeng多渠道以及不同的umeng appkey的一个很好的参考

参考链接

参考内容如下:
AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.myapplication" >

    <application  android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" >
        <activity  android:name=".MyActivity" android:label="${label}" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
         <meta-data  android:name="com.google.android.maps.v2.API_KEY" android:value="${mapKey}" />
    </application>

</manifest>

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.myapplication"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
        manifestPlaceholders = [label: "defaultName"]
        manifestPlaceholders = [mapKey: "your_debug_key"]

    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            manifestPlaceholders = [mapKey: "your_release_key"]
        }
    }
    productFlavors {

        flavor1 {
            manifestPlaceholders = [label: "flavor1"]
        }
        flavor2 {
            manifestPlaceholders = [label: "flavor2"]
        }
        flavor3 {
            manifestPlaceholders = [label: "flavor3"]
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

你可能感兴趣的:(android,gradle,多渠道,杜伟)