简体   繁体   中英

Google maps not showing all of a sudden in Android

I am currently developing an application in Android that uses Google maps. I have followed all the instructions like

  • Including the google play services dependency to my project
  • Downloading google play services in Android SDK
  • Creating an Android key from google developers console.
  • giving the necessary permissions

The google maps were showing up normally as expected until suddenly a black screen starts appearing now.

I get the following lines on logcat.

W/ResourcesManager﹕ Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.

W/ResourcesManager﹕ Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.

I/Google Maps Android API﹕ Google Play services client version: 6587000

I/Google Maps Android API﹕ Google Play services package version: 6774436

This is the dependency I have in my build.gradle file

compile 'com.google.android.gms:play-services:6.5.87'

How do I resolve this issue? Is it due to some update to the google play service? If so I have checked the SDK and I have the latest Google play service installed. Kindly help anyone

Here is the log cat

02-19 13:53:01.212  14731-14749 D/OpenGLRenderer﹕ Render dirty regions requested: true
02-19 13:53:01.218  14731-14731 D/Atlas﹕ Validating map...
02-19 13:53:01.292  14731-14749 I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/03/14, c40da3f, Ifda814c646
02-19 13:53:01.293  14731-14749 I/OpenGLRenderer﹕ Initialized EGL, version 1.4
02-19 13:53:01.311  14731-14749 D/OpenGLRenderer﹕ Enabling debug mode 0
02-19 13:53:04.472  14731-14731 I/x﹕ Making Creator dynamically
02-19 13:53:04.477  14731-14731 W/ResourcesManager﹕ Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
02-19 13:53:04.478  14731-14731 W/ResourcesManager﹕ Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
02-19 13:53:04.503  14731-14731 I/Google Maps Android API﹕ Google Play services client version: 6587000
02-19 13:53:04.515  14731-14731 I/Google Maps Android API﹕ Google Play services package version: 6774436

Try these things if your code does not have these:

  • Try adding android:name="com.google.android.gms.maps.SupportMapFragment" to your fragment.xml.

  • Try using extend Fragment instead of extend SupportMapFragment.

  • onMapReady() is triggered by a call to getMapAsync() on your MapFragment be sure to have that.

  • Also check your manifest file if it lacks some permissions

     <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.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <permission android:name="your.package.name.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="your.package.name.permission.MAPS_RECEIVE"/> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> 

Post your log cat so that the exact cause may be found out!!

  • remove following import from the list and corresponding methods

     import android.location.LocationListener; 
  • instead use Location listner from the Google API class and change your interface to complete namespace instead com.google.android.gms.location.LocationListener

For example if you are deriving from interface check text in BOLD

public class Option extends FragmentActivity implements View.OnClickListener, ConnectionCallbacks, OnConnectionFailedListener, LocationSource, com.google.android.gms.location.LocationListener , OnMyLocationButtonClickListener, OnMapReadyCallback {

If do not give complete namespace by default compiler takes Android standard LocationListner and gives error.

Please check you have both the permissions in your Manifest -

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

I recently upgraded on my Eclipse on Windows, the Android SDK using Android SDK manager. The Google map that was working earlier stopped working. Looks like there are several changes in the new google play services version 29.

Strange thing - After downloading and updating to new SDK Android 6.0 the earlier google play services files disappeared in the folder. And several error related to google play services cropped up as the file and the project google_play_services.jar was no longer there in the folder \\adt-bundle-windows-x86_64-20140702\\sdk\\extras\\google\\google_play_services

I then downloaded the version 28 as given in the page as given by Brad Larson Missing "<sdk>/extras/google/google_play_services/libproject" folder after update to revision 30 - After this all error related to google play services disappeared when build target was 5.1.1.

Then while running the app I was still getting error /system/framework/com.google.android.maps.jar does not exist or contains no resource error

(1) As suggested by bummi above I switched from Android 5.1.1 (SDK 22) to Google API 5.1.1 and it started working!! (2) I also tried compiling with Google API 6.0 and it worked.

All other things as told by Bummi above also needs to be there which I had in my project anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM