I'm currently working on getting an old Titanium SDK 1.x app working in the modern era on Titanium SDK 3.1.2.
One of the challenges I've managed to find myself stuck on is after upgrading from Google Android Maps API v1 to v2 I'm consistently getting this error:
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
I have installed in the ADK the 18.0.1 build tools as well as the required Google Play Services extras package. Uninstalling/reinstalling does nothing useful, and as far as I can tell there's no way to manually include the Play Store Services library in Titanium.
For reference I followed the instructions here to set up the Maps API v2 in the app. The following is what is in my tiapp.xml file (I replaced the actual package names):
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<permission android:name="com.example.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<application>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="###"/>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10"/>
</application>
Note that the correct certificates and correct API have been used within the Google API Console.
Does anyone have any idea why I might be unable to load the Google Play Services in my Titanium app?
Thanks in advance!
The maps only work on device. Are you running this in the emulator?
I have an additional permission set "android.permission.ACCESS_NETWORK_STATE"
Also double check to ensure your appId is correct and matches what is in your tiapp.xml file
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<!-- uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" -->
<!-- Camera Access -->
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<!-- Allows the API to download data from Google Map servers -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- Allows the API to cache data -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Use GPS for device location -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Use Wi-Fi or mobile connection for device location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<!-- Allows the API to access Google web-based services -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- Specify OpenGL ES 2.0 as a requirement -->
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<!-- Replace <com.domain.appid> with your application ID -->
<uses-permission android:name="com.wiley.TIgram.permission.MAPS_RECEIVE"/>
<permission android:name="com.wiley.TIgram.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<application android:hardwareAccelerated="true" android:theme="#android:style/Theme.Holo.Light">
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="XXXXXXXXXXXXXXXXXXXXXXXX"/>
<activity android:configChanges="keyboardHidden|orientation" android:name="ti.modules.titanium.media.TiCameraActivity" android:screenOrientation="landscape" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen"/>
</application>
</manifest>
</android>
This is more of a suggestion than an answer but I got the same error and it made me bark up the wrong tree for quite some time before I realized I had an error somewhere else in the code. In my case, there was a view element that had a null attribute, though that wasn't clear from the stack trace. The Play Services error you pasted above was visible early on but it seems that the compiler will ignore it if the service is found.
:(
To make matters more confusing, I built the same code for iOS and there was no error.
Related
Though I know this has been a persistent and addressed issue, everyone's problem seems to be solved a different way every time. I have been trying to get my map to show all day but to no avail. I had a project which had a map in it, so what I migrated that project to another location and set up Google Play Services in that project. I got everything to work except for the map to show. I have the library as i am able to use LatLng but the map always fails to load. I have generated new keys, deleted and re added the key, and deleted and re added the debug keystore. I have also updated the api console to ensure everything lined up but my map still doesnt show. I have Google Map for Android Api enabled in the console. And my package name is correct also. I have ran a clean rebuild and uninstalled the app to see if it works but it still doesnt load.
NOTE: I have also tried using SupportMapFragment instead.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.wallfly"
android:largeHeap="true">
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Actionbarstyle">
<activity
android:name="com.android.wallfly.MyActivity"
android:label="#string/app_name" >
</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="(Actual API Key)" />
</application>
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.android.wallfly.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.android.wallfly.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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.WRITE_SETTINGS" />
<!-- these grant the app the ability to access location. coarse is wifi and cellular, fine is gps -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
I have added an image to show that my package name lines up. Also i copied and pasted the SHA1 fingerprint so I am sure that it does line up also.
For those who may face a similar problem, my google play service was outdated. So I had to change the build.gradle the current version of google play service.
To add Google Maps to your android application, you need to include a few permissions:
<!-- Required -->
<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" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- Optional -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
However, by checking Google Maps Android API v2 documentation again, I noticed that
com.google.android.providers.gsf.permission.READ_GSERVICES
is no longer required. I tested it by removing it from AndroidManifest.xml and the map is loading fine without any problems.
So, my question is.. what is/was the purpose of READ_GSERVICES permission?
Note: Even though it is removed from Google Maps Android API v2 documentation, it can be found on
Google Maps API for Business documentation.
All permissions you need for Google Maps Android API are in the docs:
You must also request the android.permission.WRITE_EXTERNAL_STORAGE permission.
Note: If you're targeting the Android M SDK (23) and the latest version of the Google Play services SDK (8.1), you no longer need the WRITE_EXTERNAL_STORAGE.
From the next release of the Google Play services SDK, the requirement for the WRITE_EXTERNAL_STORAGE permission will be completely dropped from the Google Maps Android API.
So the answer is NO, you don't need it if you use current latest GPS, i.e. 8.1.0.
NO, This persimmons is no longer required in google MAP API V2
<permission
android:name="phonelocation.example.asuss550c.phonelocation.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
You only need to add
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Also this MetaData in your Application Tag
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
When I try to debug my project I got this error using debug certificate
I already ensure that my package name and SHA-1 corresponds to my api key
Here's my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.example">
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="15" />
<!-- Google Maps for Android v2 requires OpenGL ES v2 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- We need to be able to download map tiles and access Google Play Services-->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Allow the application to access Google web-based services. -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- Google Maps for Android v2 will cache map tiles on external storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Google Maps for Android v2 needs this permission so that it may check the connection state as it must download data -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Permission to receive remote notifications from Google Play Services -->
<!-- Notice here that we have the package name of our application as a prefix on the permissions. -->
<uses-permission android:name="com.example.permission.MAPS_RECEIVE" />
<permission android:name="com.example.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
<!-- These are optional, but recommended. They will allow Maps to use the My Location provider. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:label="map" android:icon="#drawable/Icon">
<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="map_key" />
</application>
</manifest>
Here's my API KEY
Here's my SHA-1 certificate
I got my SHA-1 using eclipse
By the way I'am using real device in debugging my project, c#, visual studio 2012 and xamarin.android. It only displays white screen with google logo and zoom in and out button. What's wrong with my debug certificate?
If the key is new ( has just been created in Google APIs Console ) it will take some time for it to be available to Google Maps.
Don't worry everything is declared OK, it just takes some time.
Edit : By what is written in the log looks like you have to add the fingerprint for your debug key store : D9595..
Just add a new line in Google APIs console with that fingerprint . Your debug keystore is found at C:\Users\.android\debug.keystore and the default password is : android
I'm trying to test Gmaps example of Android developer from Android SDK Manager.
The Google Play Service was imported as a Library.
The libs folder was cleaned from the library project;
The maps sample was imported;
In project properties --> Android, I have the following configs:
Google API's instead of standard Android;
Library --> Google play services is green.
The errors that are presented:
The import com.google.android.gms.location cannot be resolved
The method setImage(BitmapDescriptor) is undefined for the type
GroundOverlay
The method flat(boolean) is undefined for the type MarkerOptions,
and others methods undefined.
I'm newbie in Android development, so.. what is wrong?
Could someone help me with this? Thanks.
Have you made changes in your manifest?What about the key which is to be registered in Google console and is to be declared in the manifest file?
Some permissions need to be declared in the manifest file like:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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="com.example.gps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
and the key is to declared in meta data:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your key value" />
I used google map v2 in my android application, i created my api key in the google console.
But always i have this result in the emulator :
someone help me please ?
First make sure you have internet access with your simulator.
Then make sure you have the following in your manifest:
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR_API_KEY"/>
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
And opengl2:
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
DOC HERE
If this is still not ok, then try to use GENYMOTION emulator (with google apps).
Hope this will help you.