1

I have a project with three productFlavors and three buildTypes, and for every resultant app, the "package" name is different. My gradle file looks like this:

productFlavors {
    flavor1 {
        applicationId "com.example.flavor1"
    }

    flavor2 {
        applicationId "com.example.flavor1"
    }

    flavor3 {
        applicationId "com.example.flavor1"
    }
}

buildTypes {
    debug {
        applicationIdSuffix ".dev"
        versionNameSuffix "-dev"
    }

    integration {
        applicationIdSuffix ".int"
        versionNameSuffix "-int"
    }

    release {

    }
}

I have registered for an API key in the Google Developers Console with the package name com.example.flavor1.dev, and added the key to my manifest, but when I try to use the service, I receive an error with the message PLACES_API_INVALID_APP, so I assume something must be wrong with the package name, but I don't know what. Has someone ever had an issue like this?

Thanks!

Jorge
  • 285
  • 2
  • 10
  • Please provide the full logcat error. Most likely the package name is not being generated as you expect. – Daniel Nugent Mar 04 '16 at 03:35
  • This is what logcat returns: 03-03 21:56:25.416 31735-31735/? E/Places: Error while autocompleting: PLACES_API_INVALID_APP 03-03 21:56:25.536 30936-30936/com.example.flavor1.dev E/MyTag: PLACES_API_INVALID_APP – Jorge Mar 04 '16 at 03:57
  • You have that exact package in your api key? – Daniel Nugent Mar 04 '16 at 04:27
  • Yes, I do. That it is what I put in the developer console and it did not work. – Jorge Mar 04 '16 at 20:23

2 Answers2

2

Follow following steps: 1> Creating one new projects on Google Developer Console

2> API Manager > Credentials > New Credentials > API Key > Android Key > Press Create Button & Generate API KEY

Here, Creating key without applying package of application & SHA fingerprint is working in any application

MUST REMEMBER:

Enable Google Places API for Android

pskkar
  • 432
  • 1
  • 4
  • 18
  • 1
    Seems like removing the SHA1 and the package name works for now, but still, I'd like to be able to specify the package name and restrict the use of the API key only for my app – Jorge Mar 04 '16 at 04:02
0

I solved the problem by creating a new API key with new credentials.

double-beep
  • 5,031
  • 17
  • 33
  • 41