Google map api v2 displays a blank screen with zoom buttons on the emulator

Solution The problem was caused by the fact that Google Maps Android API v2 is not supported on the emulator. Using a real device for testing solves the problem.

Question I'm trying to find a Google map, I received an API key from Google. But when I launch the application, it shows a blank white screen with zoom buttons.

Here is my code - MainActivity.java

public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } 

Here is my XML file - activity_main.XML

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <fragment class="com.google.android.gms.maps.MapFragment" android:id="@+id/map" android:layout_height="wrap_content" android:layout_width="wrap_content" /> </LinearLayout> 

Here is the Manifest.XML file

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.demogooglemapv2" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <permission android:name="com.example.demogooglemapv2.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <uses-permission android:name="com.example.demogooglemapv2.permission.MAPS_RECEIVE"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <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="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <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="AIzaSyB2jvxyj-WbkYc1Y1WR9Sc1E1W22QywA_k" /> <activity android:name="com.example.demogooglemapv2.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> </application> </manifest> 
+7
android
source share
3 answers

You must create a map key with the debug / release keystore where the APK will be created.

+3
source share

To create a debug storage api key, follow this. Try this with the command line

 C:\Program Files\Java\jdk1.7.0_01\bin\keytool.exe -v -list -alias androiddebugkey -keystore "C:\Users\android3\.android\debug.keystore" -storepass android -keypass android 

Note: the path of debug.keystore will be changed for you C:\Users\android3\.android\debug.keystore by default debugkeystore is present in the .android folder

+2
source share

I find that if initially you accidentally made a mistake in androidManifest. and once you have fixed it and you have confirmed that It helps to remove the application from your device and reinstall it from your development environment. somehow, Android caches this information.

0
source share

All Articles