【问题标题】:Different Apks for android using gradle buildTypes使用 gradle buildTypes 的 Android 的不同 Apk
【发布时间】:2018-09-26 23:49:13
【问题描述】:

我正在尝试在同一设备上同时安装调试版本和发布版本,因此尝试将 applicationIdSuffix 添加到 gradle 文件的 buildTypes 块中,如文档中所述。没有提到要创建任何包,而是说找不到包错误。请帮忙。

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

def versionMajor = 1
def versionMinor = 0
def versionPatch = 4
def versionBuild = 0

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.edu.gcfapp"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
        versionName "${versionMajor}.${versionMinor}.${versionPatch}"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {

        debug {
            applicationIdSuffix ".debug"
        }

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    flavorDimensions "default"

我得到的错误是这个..

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDevDebugGoogleServices'.
> No matching client found for package name 'com.edu.gcfapp.debug'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

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

BUILD FAILED in 9s

【问题讨论】:

    标签: android gradle android-gradle-plugin android-productflavors


    【解决方案1】:

    看起来您正在使用 Google 服务,尽管您从 gradle 中省略了它。

    您的 google 配置文件(我认为是 google-services.json 文件)不包含 com.edu.gcfapp.debug 的任何配置信息

    返回您的 google 控制台并为您的发布和调试包名称创建一个文件,并将它们放在相关的构建文件夹中。

    【讨论】:

      猜你喜欢
      • 2022-10-24
      • 2014-05-17
      • 2017-01-15
      • 2013-09-17
      • 1970-01-01
      • 2013-07-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多