9

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?

2
  • Which gradle task throws this error?
    – jbarat
    Jul 27, 2016 at 10:11
  • org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':myApp:processDebugGoogleServices'.
    – Jon
    Jul 27, 2016 at 10:14

2 Answers 2

19

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/.

4
  • 6
    It's fine to duplicate your existing google-service.json and just modify the package_name to be com.foo.bar.debug. developers.google.com/android/guides/… Jun 6, 2019 at 10:16
  • Thanks @david_adler. That explains also how to deal with different flavors, that was exactly what I needed. Sep 18, 2019 at 10:19
  • 1
    Tried just copying the Google services, I am still getting this error
    – giorgio79
    Nov 1, 2020 at 20:20
  • didn't work. Adding a package name +.debug will break oauth clients with Firebase etc.
    – giorgio79
    Nov 2, 2020 at 8:38
0

The answer given by @jbarat works. For Firebase authentication @giorgio79 you have to add SHA certificates to the project for the debug app in the settings of the firebase console. To get the SHA1 and SHA256 certificates, enter the following commands in your terminal(command differ from OS)

cd android
./gradlew signingReport

Copy the debug SHA certificates and add them.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.