重命名包名称-Android后,Google Maps Api无法识别包名称

时间:2020-12-20 20:50:29

I have added Google Maps to my Android Application. When using the API key of my Old package name the map is loading properly.

我已将Google地图添加到我的Android应用程序中。使用旧包名称的API密钥时,地图正在正确加载。

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.

在此过程之后,我通过Refactor-> Rename重命名了包,文件中的所有包名都已更改,然后我创建了一个带有新包名的API密钥。

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

但是Map没有加载新的API密钥,而是使用旧的API密钥(旧的包名称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.

我不能正确地重命名包名称,或者是否有任何特定的位置我应该重命名为使用新的API密钥加载地图。

2 个解决方案

#1


0  

Follow these steps

按着这些次序

-Go to Google API console

- 转到Google API控制台

-And login with your credentials

- 使用您的凭据登录

-Click the menu expansion button go to credentials menu

- 单击菜单扩展按钮转到凭证菜单

-in here you got API key list that you have

- 你在这里有API密钥列表

-Then you can edit your package name with edit button

- 然后您可以使用编辑按钮编辑包名称

Thank you

谢谢

#2


0  

If you're using Android Studio, go to build.gradle and rename your applicationId in

如果您使用的是Android Studio,请转到build.gradle并重命名您的applicationId

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.

另外,请记住在AndroidManifest.xml中更新软件包名称。希望,这会有所帮助。最后,从手机中卸载旧应用。

#1


0  

Follow these steps

按着这些次序

-Go to Google API console

- 转到Google API控制台

-And login with your credentials

- 使用您的凭据登录

-Click the menu expansion button go to credentials menu

- 单击菜单扩展按钮转到凭证菜单

-in here you got API key list that you have

- 你在这里有API密钥列表

-Then you can edit your package name with edit button

- 然后您可以使用编辑按钮编辑包名称

Thank you

谢谢

#2


0  

If you're using Android Studio, go to build.gradle and rename your applicationId in

如果您使用的是Android Studio,请转到build.gradle并重命名您的applicationId

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.

另外,请记住在AndroidManifest.xml中更新软件包名称。希望,这会有所帮助。最后,从手机中卸载旧应用。