打包配置问题

来源:互联网 发布:matlab 三维矩阵 画图 编辑:程序博客网 时间:2024/05/22 04:55

清单文件配置:

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"          package="com.example.administrator.myapplication">    <uses-sdk android:minSdkVersion="8"></uses-sdk>    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />    <uses-permission android:name="android.permission.INTERNET"/>    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>    <application        android:allowBackup="true"        android:icon="@mipmap/ic_launcher"        android:label="@string/app_name"        android:roundIcon="@mipmap/ic_launcher_round"        android:supportsRtl="true"        android:theme="@style/AppTheme">        <activity android:name=".MainActivity">            <intent-filter>                <action android:name="android.intent.action.MAIN"/>                <category android:name="android.intent.category.LAUNCHER"/>            </intent-filter>        </activity>        <meta-data            android:name="UMENG_APPKEY"            android:value="00000000000000"></meta-data>        <!--渠道号-->        <meta-data            android:name="UMENG_CHANNEL"            android:value="${UMENG_CHANNEL_VALUE"></meta-data>    </application></manifest>

APP build.gradle配置

apply plugin: 'com.android.application'android {    compileSdkVersion 26    buildToolsVersion "26.0.0"    defaultConfig {        applicationId "com.example.administrator.myapplication"        minSdkVersion 15        targetSdkVersion 26        versionCode 1        versionName "1.0"        // dex突破65535的限制        multiDexEnabled true        // 默认是umeng的渠道        manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"]    }    lintOptions {        abortOnError false    }    signingConfigs {        debug {            // No debug config        }        release {            storeFile file("app.jks")            storePassword "      "            keyAlias "app"            keyPassword "       "        }    }    buildTypes {        release {            minifyEnabled true            zipAlignEnabled true            zipAlignEnabled true            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'            signingConfig signingConfigs.release            applicationVariants.all { variant ->                variant.outputs.each { output ->                    def outputFile = output.outputFile                    if (outputFile != null && outputFile.name.endsWith('.apk')) {                        // 输出apk名称为boohee_v1.0_2015-01-15_wandoujia.apk                        def fileName = "${variant.productFlavors[0].name}" + ".apk"                        output.outputFile = new File(outputFile.parent, fileName)                    }                }            }        }    }    productFlavors {        wandoujia {}        _360 {}        baidu {}        xiaomi {}        tencent {}        taobao {}    }    productFlavors.all { flavor ->        flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]    }}dependencies {    compile fileTree(dir: 'libs', include: ['*.jar'])    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {        exclude group: 'com.android.support', module: 'support-annotations'    })    compile 'com.android.support:appcompat-v7:26.+'    compile 'com.android.support.constraint:constraint-layout:1.0.2'    testCompile 'junit:junit:4.12'}

gradlew assembleRelease