My Android App shows the google map in debug but d

2019-02-28 07:50发布

问题:

I have an app that I have created that uses the Google Maps and Google Playstore and in debug using Eclipse and the Android SDK the map shows up on the device I am running but when released it doesn't show up on the app. Theres just a big grey screen.

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.eema"
     android:versionCode="5"
     android:versionName="5" >

     <uses-sdk
         android:minSdkVersion="8"
         android:targetSdkVersion="10" />

     <permission

         android:name="com.eema.permission.MAPS_RECEIVE"
         android:protectionLevel="signature" />

     <uses-permission android:name="com.eema" />
     <uses-permission android:name="com.eema.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.VIBRATE"/>   
    <uses-permission android:name="android.permission.INTERNET"/>  
<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" />

     <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="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />

         <activity
             android:name="com.eema.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>
         <activity
             android:name="com.eema.MapViewActivity"
             android:label="@string/title_activity_map_view" >
         </activity>
         <activity
             android:name="com.eema.NoConnectionActivity"
             android:label="@string/title_activity_no_connection" >
         </activity>
         <activity
             android:name="com.eema.ShelterActivity"
             android:label="@string/title_activity_shelter" >
         </activity>
         <activity
             android:name="com.eema.FuelStopActivity"
             android:label="@string/title_activity_fuel_stop" >
         </activity>
         <activity
             android:name="com.eema.DirectionsActivity"
             android:label="@string/title_activity_directions" >
         </activity>
         <activity
             android:name="com.eema.EvacRouteTableActivity"
             android:label="@string/title_activity_evac_route_table" >
         </activity>
     </application>

 </manifest>

Could it be the Keystore. I have a release keystore file that was generated do I need to get the keystore from that if so how?

回答1:

Are you just seeing gray screen then... it's almost definitely the API key that is wrong. The Emulator uses the debug keystore, with androiddebugkey, so you should create an API key for that. Remember to change it when you publish the app to the market

refer this



回答2:

When U make your apk file. U need create a keystore. Now, using that keystore to get MD5 using "Keytool", like you did with debug keystore. After that, U need to register API key from MD5, you just got. And late, U use API key in your android manifest.



回答3:

I assume it is a keystore problem. Get the SHA1 from the keystore using the "keytool" And register it like you did with the debug keystore.

And you are good to go.