Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: buildTypes applicationIdSuffix error

I want to setup a project to build two different apks that can be installed on the same device - one of them a production apk and the second one a debug apk. To do this I've defined in the build.gradle:

buildTypes {
        release {

        }

        debug {
            applicationIdSuffix = ".debug"
        }

    }

but when I try to sync the gradle I get the error:

Error:org.gradle.api.GradleException: No matching client found for package name 'mypkg.debug'

Aside from the buildTypes section of build.gradle, what else should I do to make this work properly?

like image 886
Jon Avatar asked Jul 27 '16 10:07

Jon


People also ask

What is productFlavors Android?

Android Product Flavors are used to create different app versions. App versions can be free or paid. They can have different themes and texts. They can use different environments or APIs. Let's assign two product flavors free and paid in our application.

What is Flavour dimension Android?

The flavor dimensions define the cartesian product that will be used to produce variants. Example: flavorDimensions("dimA", "dimB") productFlavors { row1 { ... dimension = "dimA" } row2 { ... dimension = "dimA" } row3 { ... dimension = "dimA" } col1 { ...

What is Buildtype in Gradle Android?

A build type determines how an app is packaged. By default, the Android plug-in for Gradle supports two different types of builds: debug and release . Both can be configured inside the buildTypes block inside of the module build file.

What are buildTypes and product Flavours in Gradle?

Build variants are the result of Gradle using a specific set of rules to combine settings, code, and resources configured in your build types and product flavors. Although you do not configure build variants directly, you do configure the build types and product flavors that form them.


1 Answers

You need to provide a google-service.json for every build flavor. In your case you need a debug one.

Generate a new one with the new package name (the original package name + .debug). Then put the json into app/src/debug/.

like image 65
jbarat Avatar answered Nov 08 '22 21:11

jbarat