I got the SHA1 from Eclipse Windows\Preferences\Android\Build, entered it in the API console in the form of key com.mypackage, got the API key entered it in the manifest and the map is still not showing.
I tried with the cmd and still not working, it shows the same SHA1 as Eclipse.
Am I missing something?
In my case google map was not rendering.
Only Goolge was displayed below left corner
I have Followed below steps
created again new project in Google api console.
Passed my SHA1 key then semicolon then your application package name
Your_SHA1_Key;Your_APP_PACKAGE_NAME
You will get one API_KEY
Then mention below things in your manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR_API_KEY" />
It may help you.
All the best.
Add this line in manifest file before your activity and inside application tag
<uses-library android:name="com.google.android.maps" />
That should solve your problem.
Its good to add errors and related xml snippets in the question for better understanding of your problem.
perhaps this link show you steps one by one.
for more clarity checkout this link.
There are so many things you should maintain, if you add your Manifest file, then it will be easy for us to give answer. Though I give you my manifest file please follow this and change the package.name only
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="package.name.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="package.name.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="package.name.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="***Your API Key***"/>
</application>
In your XML layout file paste this:
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/tv_location"
class="com.google.android.gms.maps.SupportMapFragment"
/>
Try this and let me know.
Add Google play service as a library.
Put
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-library android:name="com.google.android.maps"/>
in Manifest.xml
Follow the instructions given here. After creating your project in Google Developers Console, select APIs, you will be prompted with a section of Popular APIs, select Google Maps Android API. Press enable API.(the image below is showing the steps in the new version of the console)
If you're still using the old console, enable the API, by selecting Services, then switch the button ON:
Note:
You don't need to enable the API for the debug version!
Here is nice blog that will be helpful.
You may be signing your app with a different certificate other than the one in your debug.keystore file located in your .android folder.
Make sure the SHA1 certificates match i.e the certificate in your credentials are the same with the one you're using to sign your app
Related
I am trying to make an app which starts by asking permission and accesses the hotspot of any device and any android version with which the very first problem which is bothering me is that why is not working, i have tried it on two devices and both of the attempts were unsuccessful.Please can anyone help me out to point my mistake. I checked similar questions related to it and have tried correcting it too but still not working..
here is the xml code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.akshay.turnonhotspot2">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It is changed since Android API 23.
You also have to ask permissions at Runtime.
Check this document
Permissions are asked when when you need user personal data such as contacts, storage(photo, video, file) and etc..
You don't need to ask permission for android.permission.INTERNET, android.permission.ACCESS_NETWORK_STATE, android.permission.ACCESS_WIFI_STATE, android.permission.CHANGE_WIFI_STATE
I'll keep it short as possible. Got an app working properly on all API level 22 devices and under, but with the new versions above 22 that had the new implementations of rules regarding permissions, I get this error message trying to fetch a file, stating it cannot be found because I don't have the right permission.
Naturally, before asking, I've did some googling and found that people make this problem go away by making the targetSdkVersion in the 'uses-sdk' AndroidManifest tag set to 22. I did so, even added permissions inside the manifest, but I'm still getting this error.
Here's the whole manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packagename.appname">
<uses-sdk android:targetSdkVersion="22"></uses-sdk>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.any"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
So what's the deal here?
I should mention that the app works flawlessly on the API 22 device and I've checked, the path of the file is the same, so to my best knowledge, it's a permission issue.
Historically, targetSdkVersion was set via the <uses-sdk> element.
In Gradle-based Android app development, such as via Android Studio, the targetSdkVersion usually is set in the module's build.gradle file (e.g., app/build.gradle). The value set in Gradle overrides the value set in the manifest.
As a result, adding <uses-sdk> to a manifest may not appear to have any effect, simply because Gradle is overriding the values.
My app uses the Google Places API to function however when I use the line placeLikelihoods.getStatus().getStatusMessage() , I get the message PLACES_API_KEY_INVALID. I've been googling for days and can't find a solution. When I go to https://console.developers.google.com/apis/credentials?project=myprojectdebug and click on my project, I am redirected to a page that shows my API key, the date I made it and my email used to make it.
This is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="censored b/c its got some private stuff in name">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-deta
android:name="com.google.android.geo.API_KEY"
android:value="My 39 character API key is here" />
</application>
What am I doing wrong? I feel like giving up but I also want to know what's wrong
EDIT: Found the problem however I can't fix it. I didn't use the proper keytool command shown here https://support.google.com/googleapi/answer/6158862 but when I run this command it gives me an error because my account name has a space between my first and last name thanks to me using a microsoft account.
Ok, i got your error. You misspell meta-data. Check your tag, you wrote 'meta-deta'
check this one in your manifest file i placed
android:name="com.google.android.maps.v2.API_KEY"
instead of this (place below one and check spelling)
android:name="com.google.android.geo.API_KEY"
in your AndroidManifest.xml file like
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/api_key"/>
1) Have you enable/activate google place api?
2) Did you keep switching your workstation? If you run your code using another pc (not the original one you use to generate api key), you need to request new API key because the debug key has changed.
I am trying to integrate Google Play Services into my application in order to enable achievements. Upon application launch, a login attempt is being made which results in one of the following errors:
There was a problem communicating with Google servers.
Failed to log in. Please check your network connection and try again later.
A̶p̶p̶l̶i̶c̶a̶t̶i̶o̶n̶ ̶c̶r̶a̶s̶h̶e̶s̶
The application is incorrectly configured. Check that the package name and signing certificate match the cliend ID created in Developer console. Also, if the application is not yer published, check that the account you are trying to sign in with is listed as a tester account. See logs for more information.
Logcat displays absolutely no data related to this problem so I don't even have a clue what could be wrong. The app is authenticated correctly, with the correct SHA1 certificate fingerprint and app id copied to manifest. Does anyone have any could what this could be?
Thanks.
EDIT: Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.*****.xxx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.app.Main"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.app.GameAct"
android:label="#string/title_activity_game"
android:screenOrientation="portrait" >
</activity>
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="#string/app_id" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
I resolved the issue I had by deleting Google+ data related to my previous game login and logging in again. I do not know what caused this error in the first place but it may be due to wrong settings in my Developer Console. I did change some things, like re-authenticated the app but the changes took effect only after deleting old data.
I'm trying to display the google map for an android project. I followed all the steps without any problems, but when i launch my application, the map simply doesn't show up, i just have a white screen.
This is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.map.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.map.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MyKeyXXXXXXX" />
<activity
android:name="com.map.HomeActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.map.MapActivity"
android:label="#string/title_activity_map" >
</activity>
</application>
</manifest>
Does anyone see something wrong ?
thanks in advance
Here are the steps you should follow:
Grab the Google Play services SDK (It's where the Maps API is)
Get the API key
Set the key in the Application Manifest
Last but not least, don't forget that Google Maps will only show if your app is signed with the key you provided to get the Maps key.
For example, if you've used a production certificate and you're testing the app with the debug key, you won't be able to see the maps.
I had this problem too. Your API key is not the giant series of two characters. On the Google Maps API console, after you have created your project and enabled Google Maps, you need to go to the API Access page, and click on "Create a new Android Key" if you don't have one already.
Your API Key that you use in your app is the ~40 character string that appears on the new key. Paste that into the Manifest and it should work.