清单文件:
<meta-data android:value="5af813bdf43e48795800006d" android:name="UMENG_APPKEY"/> <meta-data android:value="${UMENG_CHANNEL_VALUE}" android:name="UMENG_CHANNEL"/>
依赖:
apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "com.wode.killpackbao" minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" manifestPlaceholders = [UMENG_CHANNEL_VALUE:"umeng"] testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } flavorDimensions "color" productFlavors { xiaomi{ // manifestPlaceholders = [UMENG_CHANNEL_VALUE: "xiaomi"] // dimension "color" applicationIdSuffix "xiaomi" resValue "string", "app_name", "xiaomi" } wandoujia{ // manifestPlaceholders = [UMENG_CHANNEL_VALUE: "wandoujia"] // dimension "color" applicationIdSuffix "wandoujia" resValue "string", "app_name", "wandoujia" } yingyongbao{ applicationIdSuffix "yingyongbao" resValue "string", "app_name", "yingyongbao" } } productFlavors.all { flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' compile 'com.umeng.sdk:common:1.5.0' compile 'com.umeng.sdk:analytics:7.5.0' }