zxf_2016
X峰
采纳率33.3%
2017-10-12 06:35

试验多渠道打包遇到的问题

已采纳

开发工具:Android studio 3.0 Beta 2
做多渠道打包遇时遇到的问题
app下的build.gradle如下:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"

defaultConfig {
    applicationId "com.zxf.multipacking"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        // 自定义输出配置
        applicationVariants.all { variant ->
            variant.outputs.all { output ->
                def outputFile = output.outputFile
                if (null != outputFile && outputFile.name.endsWith('.apk')) {
                    def fileName = "demo_${variant.productFlavors[0].name}-${defaultConfig.versionCode}-${defaultConfig.versionName}}.apk"
                    outputFileName = new File(outputFile.parent, fileName)
                }
            }
        }
    }

    debug {
        minifyEnabled false
        applicationIdSuffix ".debug"
    }
}

productFlavors {
    flavorDimensions "default"
    one {
        dimension "default"
    }

    two {
        dimension "default"
    }

    productFlavors.all { flavor ->
        flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
    }
}

}

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

之后在terminal中执行gradle assemble打渠道包,报错。如下:

  • What went wrong:
    Could not dispatch a message to the daemon.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

有哪位大神路过,帮忙指点迷津。万分感激!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

为你推荐