google map authenticate failed, after package name changed - android

I have an android app with a Google map, everything works good.
In order to publish it in Google play, I changed the package name (old package com.exmaple..) from project----- Android tools---Rename Application Package
So, I going to generate a new API key with my new package name.
I changed manifest with the new key.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxnew keyxxxxxxxxxxxxx" />
But, it did not work. It said authentication failed.
Is there any idea? Did I miss some steps?
Thanks in advance!

If you are saying that you have generated the new key using the API Console and changed the API key in your application as well as changed the package name in those two permissions:
<permission android:name="your.application.package.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="your.application.package.permission.MAPS_RECEIVE"/>
Then try to remove your application complete from the phone, as application is usually saves the old key in the cache, and then try to re-install it.

As you have renamed your package name and Google API key is generated based on the Package name and SHA1 key to uniquely identify each application. You need to regenerate your API key and then try to apply it in your manifest file.

Please check out the documentation
To access the Google Maps servers with the Maps API, you have to add a
Maps API key to your application. The key is free, you can use it with
any of your applications that call the Maps API, and it supports an
unlimited number of users. You obtain a Maps API key from the Google
APIs Console by providing your application's signing certificate and
its package name. Add the key to your application by adding an element
to your application's AndroidManifest.xml file.
You changed your package name so google map authentication is failed. Please regenerate new key with your new package name.

Addition to the answer before.
Make sure signing API key by the release keystore instead of debug.keystore

If you checked and found that the package name is configured correctly in Google API, go over the below steps
Make sure that there is no reference in your project to the old
package name. I changed it in the manifest file but forgot to change
it in the build.gradle file
Delete the .gradle folder in your project cause gradle might have cashed the old package name
Ctrl+Shift+F to look for the old package name in the entire project.Make sure there is no trace of it
Uninstall the app on your testing device to clear any cached data
Clean project and then run it
Those steps did it for me.

Related

Unable to create preview of the app actions used in the app in google assistant

I have added the shortcuts.xml in res/xml and also added the
<meta-data
android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
in the AndroidManifest.xml and also uploaded the signed bundle file in the play console internal testing.
But I'm getting the below error while creating the preview using the google assistant app actions test tool in android studio
Google Assistant plugin v2.3.0
Preview Creation Error
Status Code: 400
Message: Precondition check failed.
- Please sign in to Play Console (https://play.google.com/apps/publish) and check if you have accepted the latest Terms of Service (ToS), and the Gmail/G-Suite account has the authorization to modify the app with package name 'uninitialized.application.id'.
The part of the error message that reads
modify the app with package name 'uninitialized.application.id'
seems particularly strange. There are a few things I would make sure about:
Make sure your app/build.gradle has the correct applicationId in the defaultConfig section and that you use this Id elsewhere.
Make sure that was the version that you uploaded.
Ensure that the account that you used for the play store is the same account that you're using to for the test tool.
This issue suggests that a default applicationId may have been assigned and set in the merged manifest, and that you can just rebuild the entire project once you have it correctly set in app/build.gradle

Can Android certificates get corrupted? I am unable to upload new Play Store App update

I inherited an android app that was initially outsourced to an external developer, fixed stuff and I am now ready to send the new update to the play store.
Then I found out that I need a specific signing key in order to update the app, which we got from the previous developer.
So I generated a signed release apk using the key I got and tried to upload. Upon uploading, I get a pop-up with an error. see screenshot for details
We asked the developer if he was sure that was the key he used, and he swears he looked everywhere and its the only key he used. Although, I do think he might have changed the password for it..., not really sure.
Significant changes I introduced to the app is changing the package in manifest and creating product flavours which each their own package name(one of them got to keep the original package name from the play store).
Some things I noticed: When I got the app, the app manifest had an out-commented package name and a new one with our company's name in it. The original one had the name of the of the outsourcing company in place of the "example" of the "com.example.appname" bit, so they must have changed the package name when they created the release apk.
I have no idea if any of this means anything because the package name is the same when I put it all in an apk... It's just that the store claims that the app was signed with a different certificate and the previous developer swears he used the same he sent to us.
Can anyone tell me if it's possible to do anything to make this work, or are we completely doomed and will have to upload a new app to the store?
Thanks for any help.
Update:
Because people are asking about packagename, let me clarify.
When I got the app, all the packagenames in the manifest was not the same as the one from Playstore... so i refactored the entire package app-wide to reflect the play-store package name... and then I introduced product flavours because we need a new app with different branding that is similar to the original one... so I ended with with a structure like this:
defaultConfig {
applicationId "PlayStorePackagName"
}
productFlavors {
brand1 {
applicationId "PlayStorePackagName" //<- for original app
}
new_brand{
applicationId "NewPlayStorePackagName" //<- for new app.
}
}
In this case, it shouldn't matter what package name is in the manifest, should it?
You cannot change the package name nor the Certificate for the App for the Playstore! If you don't have the correct certificate you cannot submit your App as an update to the existing one.
Certificate checking
However you can check the information stored in your available Keystore and compare it with the current store apk. For Example:
jarsigner -verify -verbose -certs yourapp.apk
You can get more details with the keytool. See this Thread for more information.
Package name
You can check the correct package name for your app when Browsing to your App in the play store.
Example for Google Plus: https://play.google.com/store/apps/details?id=com.google.android.apps.plus
id=com.google.android.apps.plus is the package name in this case. This cannot be changed for your App
However this package name is defined by your applicationId within your App. Your structure of your app can have different package names. See here for more information.
From the docs:
When you're ready to make changes to your APK, make sure to update your app’s Version Code as well so that existing users will receive your update.
Use the following checklist to make sure your new APK is ready to update your existing users:
The Package Name of the updated APK needs to be the same as the current version.
The Version Code needs to be greater than that current version. Learn more about versioning your applications.
The updated APK needs to be signed with the same signature as the current version.
To verify that your APK is using the same certification as the previous version, you can run the following command on both APKs and compare the results:
$ jarsigner -verify -verbose -certs my_application.apk
If the results are identical, you’re using the same key and are ready to continue. If the results are different, you will need to re-sign the APK with the correct key.
You say that:
Significant changes I introduced to the app is changing the package in manifest
So this is the source of issue. You'll need to use the same package name.

Google Maps Api not recognizing package name after Renaming Package name -Android

I have added Google Maps to my Android Application. When using the API key of my Old package name the map is loading properly.
I renamed the package through Refactor->Rename after this process all the package name in the files has changed, then I created a API key with the new package name.
com.shangeeth.mapstest
changed to
com.shangeeth.simlpemapapp
But the Map is not loading with new API key but properly loading with the Old API Key(Old package name API).
Din't I properly Rename the Package name or is there any particular location where I should rename to Load the Map with the new API key.
Follow these steps
-Go to Google API console
-And login with your credentials
-Click the menu expansion button go to credentials menu
-in here you got API key list that you have
-Then you can edit your package name with edit button
Thank you
If you're using Android Studio, go to build.gradle and rename your applicationId in
defaultConfig {
applicationId "com.shangeeth.simlpemapapp"
...
Also, remember to update package name in AndroidManifest.xml. Hope, this will help. Finally, uninstall your old app from your phone.

xamarin google map not working

I created a map using the following link http://developer.xamarin.com/guides/android/platform_features/maps_and_location/maps/part_2_-_maps_api/ i followed all the procedures mentioned in it but what am getting is a blank screen. My application Output shows the following log on executing the map activity.
Open Connection [REQUEST] DRD(41): 62|147 [REQUEST] Close [REQUEST] Error processing: com.google.maps.api.android.lib6.b.d#42a1cef8 not retrying [REQUEST] Retrying: com.google.maps.api.android.lib6.c.au#429ced70
Can anyone please tell me why this is happening.
If you are unable to view the map after deploying a Release apk, follow this Video..
https://www.youtube.com/watch?v=xLJ0jDFdUZ0
As it says :
Create a KeyStore from Visual Stuido.
a. Put project config mode to Release.
b. Clean and Build your Android project.
c. Right click your Android project and select Archive (Before that specify the version code and version name in your manifest or in properties).
d. Once the archive is completed, click on Distribute.
e. Select AdHoc channel.
f. Create a new Signing Identity with Alias, Password and other info.
g. This signing key creates a KeyStore file in location :
C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore
Note : [Alias] is the name you defined when creating the KeyStore file
Open your cmd. cd to C:\Program Files\Java\jdk1.8.0_131\bin
Execute : keytool -list -v -keystore "C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore" -alias [Alias]
You will get the output with MD5, SHA1, SHA256... Copy the SHA1 key.
Go to https://console.developers.google.com . Select your project you created for Android API key.
Click on credentials and select your API key.
Add new Package name and finger print with your project's package name and SHA1 key you copied.
Note : Project's package name defined on Android Project's manifest and properties.
Wait for like 5 mins to take the changes to affect. Afterwards you can again archive and get a new APK. Install on your android device and see. You will now be able to see the map.
NOTE :: I am referring to Xamarin, Visual Studio 2017
As #Miha mentioned this is keys related.
At present you will not be getting any map tiles displayed on the map.
To get the example to work there are several things that you need to do.
1) Obtain your Signing Key Fingerprint (SHA1) for your machine.
If you haven't already created your SHA1 key for your machine you will need to do this first. The link here describes how to generate this using the command console.
You will get a SHA1 key fingerprint as a result of this.
2) Obtain the package name from the project you are working on.
This can be located by looking at the Android project properties under the Android Manifest tab. You will then see a text-box for the Package name field.
3) In Google Developer Console you will need to create an Application should you not already have one, and Create A New Android key (This is located under APIs & auth \ Credentials).
On the screen that will pop-up you will be able to enter in the SHA1 key and Package Name that you have previously captured in the format {SHA1};{Package Name}.
This will then return to you the API key that you will use in the next step:-
4) In the Android Project, look at the source for AndroidManifest.xml. You will see the following:-
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="{some api key}" />
Enter you API key in that you have previously captured.
5) In the Google Developer Console, for the project, you also have to remember that you have to enable Google Maps Android API v2 and also Google Play Android Developer API. You can find these under APIs & auth \ APIs
You should then, finally, be able to run the demo.
Update 1:-
Add the uses-permission for MAPS_RECEIVE as #leoneboaventura mentioned also, so something like the following:-
<uses-permission android:name="{your-package-name}.permission.MAPS_RECEIVE" />
I just figured out what was wrong in my case. Probably because of Java naming rules, you have to name your package with the first letter in lowercase. Visual Studio names our packages following C# naming rules, which spells the first letters capitalized.
So, check if this issue isn't the same causing your map to don't open by doing the following:
1) Make sure your package name starts with small letter.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mypackage.android" android:versionCode="1" android:versionName="1.0">
Make sure your package is named mypackage.android not MyPackage.android.
2) Make sure your package name in the following two permissions matches the manifest package name spelling:
<uses-permission android:name="mypackage.android.permission.MAPS_RECEIVE" />
<permission android:name="mypackage.android.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
3) Check if you APIKey is been generated to the same package name:
{your SHA1 certificate fingerprint}:mypackage.android
Change AndroidManifest.xml like this
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<application ...>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="yourApiKey" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
</application>
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
</manifest>

"An internal error occurred" with integration of Google Plus Login

I am trying to integrate a Google plus Login in my application as per the instruction provided by following link :
https://developers.google.com/+/quickstart/android#install-sdk
I am following all the instructions perfectly. And when I run the sample application on a real device provided in the android-sdk and click the signin button, it display a Toast message that An internal error occurred
What am I doing wrong?
I have this problem and even after creating 10 different client IDs with different SHA and package name, it doesn't work... until I found out that you have to fill the Consent screen.
According to GoogleDevelopers Console -
The consent screen will be shown to users whenever you request access
to their private data using your client ID.
This can happen when you haven't set the signature for the client ID in your API console project, or if you copied the wrong key value from keytool. Doing so is documented in the steps of the quick start guide on steps 7, 8, 9, and 10.
I've solved problem by removing .setScopes("PLUS_LOGIN") in the PlusClient.Builder.
I got this toast message error in my android application:
An internal error occurred
Summary:
Assuming you made a mistake configuring the negotiation between your android app and the Android API server granting you access. Most likely caused by you not adding the correct package name or correct SHA1 fingerprint. I followed these steps to blow out the wrong configuration and do it right.
Steps to fix:
Go to your google api console and login: https://code.google.com/apis/console
Click "API Access" tab.
Click the button: "Create another client ID".
Choose: "Installed Application" radio button.
Choose: "Android" radio button.
Enter the package name of the android app that is displaying the above error. You can find it defined at the top of the PlusSampleActivity.java code file. For me it is com.google.android.gms.samples.plus
Acquire your SHA1 fingerprint value:
a. Use the command keytool -list -v -keystore /home/el/.android/debug.keystore. Enter password, If you never set it, the default password is 'android'.
b. The SHA1 fingerprint is shown on screen, copy that.
Paste the above value into the "Signing certificate fingerprint (SHA1):" box.
Click the button: "Create client ID".
Run your android application again, click "Sign in".
Now you are presented with an Activity to "Sign in to Google+ SDK with Google".
In my case, the solution was to actually set an email address in the Consent Screen.
First, I was a bit reluctant to select my personal address and for an strange reason you can save the form without this piece of data with no error. After checking what others have suggested, as soon as I set my email address in that form, it started working.
I have been searching how to fix this for a day with full of research without luck finally i managed
to resolve this issue with the following approach.
Before i begin resolving this (at least how ti worked for me) i have to say that everything on the
documentation is correct and you don't have to change any lines of code or so.
It looks like more of a bug in the https://cloud.google.com/console cloud console
First ensure you got the correct SHA1 and your project's package name as described in the docs
https://developers.google.com/+/quickstart/android
Now this bug as i noticed (at least for me) was that in my cloud console, the project i have created
was long ago with the old interface and few months ago i migrated to the new GUI.Once you get the new look on cloud console you will notice that new projects have an auto generated project id
like this atlantean-ares-331 while old projects got a long integer value as project id which is not visible. So if your project was created with the old GUI and you have just created new client id for OAuth for that project you will get the Toast "An internal error occurred” while trying to sign in with google.
How to Fix
Go to your cloud console
Make a new project i would suggest a name like
oldprojectname-gplus
In APIs section enable Google+ API
Ensure that none of your projects has the same package name on
OAuth Client ID with the one you will use now otherwise you will get Error This client ID is globally unique and is already in use.(you will have to delete the old OAuth client id with the same package name you will use now).
Go to Credentials Create New Client ID for OAuth.
Installed application
Android
Enter your project's package name and your SHA1
Done
My solution to the problem was following.
I did everything others recommended and there was no typo regarding the package name and SHA1 key. I also tried removing the key and then adding it again but it didn't help.
What did help is removing the key and creating a new project (at https://code.google.com/apis/console) and then creating the Client ID (with package+sha1) again there. After that (5 secs) everything worked on my Android device.
This problem is related to the permissions from the api console.
if you are using a permission related with SCOPE_PLUS_LOGIN, in the api console you must create two keys, one for OAuth client id, and other for public api key.
In my case the problem was that I changed the package name of the app and didn't update in dev console.
For me it was that i was attempting to use my production key when installing it using my debug key. Make sure your using the right SHA1 from the right keystore.
I turned around to the Google IO 2013, and changed the initialization of PlusClient, then it works.
public static final String AUTH_SCOPES[] = {
Scopes.PLUS_LOGIN,
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/developerssite" };
mPlusClient = new PlusClient.Builder(this, this, this)
.setScopes(AUTH_SCOPES)
.build();
Thanks Thano for the solution
"Now this bug as i noticed (at least for me) was that in my cloud console, the project i have created was long ago with the old interface and few months ago i migrated to the new GUI.Once you get the new look on cloud console you will notice that new projects have an auto generated project id like this atlantean-ares-331 while old projects got a long integer value as project id which is not visible. So if your project was created with the old GUI and you have just created new client id for OAuth for that project you will get the Toast "An internal error occurred” while trying to sign in with google."
Recreating the project in the Google Console worked for me after several other attempts:
For any reason my project did not have a project ID (old console/new console?).
As Thano (above) suggested, I created a brand new project, created Client IDs, ... and then in worked. Thanks for the advice!!
Remember to use the built-in debug keystore for testing. I had everything else working correctly, but I had set my production keystore SHA1 fingerprint in the Credentials in the Developers Console, which caused it not to work.
If your facing this error when you try to run the sample application "or" copy the project which you have created in other machine which was running successfully in that and giving such pop-up error in the other machine where you are trying to run ,you can follow the below method and it will help.
If your are building the app for testing/debug purpose then,
1.Generate the new SHA1 if you copy your project and run it on other machine for the package name and path provided for keystore.
2.Change the ClientId in developers console for new generated SHA1 and run it in the new machine where you have copied the project and trying to run it.
Something often overlooked is the package name. I'd like to clarify the step 6 by Eric Leschinski above (can't comment there): the required package is not the package of an activity, rather the package of your app's manifest.
You may retrieve the correct value from the root element of AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ntk.darkmoor"
android:versionCode="1"
android:versionName="1.0" >
In this example define "com.ntk.darkmoor" while creating the Client ID
I had the same issue when I used SHA1 for debug.keystore for debuging then exported my application forgetting to generate SHA1 for keystore that I used to export my application.
Its working for me when i connect the device and install the apk from Android Studio.
But its now working for me when i generate the .apk and install it from dropbox.
I went through all the answers provided here and others as well. In my case the issue was the SHA-1 as well. The reason I was getting the incorrect SHA-1 was my keytool export cert command.
Previously I was using
C:\Users\mysuername\.android SHA 1 signature keytool -exportcert -alias androiddebugkey -keystore "keystorepath" -list -v
The problem was in the androiddebugkey variable. Here you have to give the name of the key you use for signing the application.
C:\Users\mysuername\.android SHA 1 signature keytool -exportcert -alias mykeyname -keystore "keystorepath" -list -v
Hope this helps someone!
To add to this long list of reasons my problem was that i got the debugkey from the jks file rather than the app.
Its always something small.

Categories

Resources