Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google maps V2 showing a white screen

I am only getting a white screen with buttons for zooming and have tried to solve this problem from a lot of answers about the same question but nothing is working out for me.So can anyone tell me what is wrong here.

Logcat :

01-29 16:48:48.703: D/dalvikvm(16910): DexOpt: couldn't find field Landroid/content/res/Configuration;.smallestScreenWidthDp
01-29 16:48:48.703: W/dalvikvm(16910): VFY: unable to resolve instance field 36
01-29 16:48:48.703: D/dalvikvm(16910): VFY: replacing opcode 0x52 at 0x0012
01-29 16:48:48.703: D/dalvikvm(16910): VFY: dead code 0x0014-0018 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b (Landroid/content/res/Resources;)Z
01-29 16:48:48.882: D/dalvikvm(16910): GC_CONCURRENT freed 194K, 46% free 3079K/5639K, external 412K/517K, paused 4ms+4ms
01-29 16:48:49.078: D/dalvikvm(16910): GC_CONCURRENT freed 129K, 42% free 3517K/6023K, external 412K/517K, paused 5ms+4ms
01-29 16:48:49.218: W/dalvikvm(16910): Unable to resolve superclass of Lmaps/p/r; (643)
01-29 16:48:49.218: W/dalvikvm(16910): Link of class 'Lmaps/p/r;' failed
01-29 16:48:49.218: W/dalvikvm(16910): Unable to resolve superclass of Lmaps/ao/an; (6521)
01-29 16:48:49.226: W/dalvikvm(16910): Link of class 'Lmaps/ao/an;' failed
01-29 16:48:49.226: W/dalvikvm(16910): Unable to resolve superclass of Lmaps/ae/i; (5640)
01-29 16:48:49.226: W/dalvikvm(16910): Link of class 'Lmaps/ae/i;' failed
01-29 16:48:49.226: E/dalvikvm(16910): Could not find class 'maps.ae.i', referenced from method maps.af.al.a
01-29 16:48:49.226: W/dalvikvm(16910): VFY: unable to resolve new-instance 5490 (Lmaps/ae/i;) in Lmaps/af/al;
01-29 16:48:49.226: D/dalvikvm(16910): VFY: replacing opcode 0x22 at 0x0091
01-29 16:48:49.257: D/dalvikvm(16910): VFY: dead code 0x0093-00a0 in Lmaps/af/al;.a (Landroid/view/LayoutInflater;Lcom/google/android/gms/maps/GoogleMapOptions;Z)Lmaps/af/al;
01-29 16:48:49.523: D/dalvikvm(16910): GC_CONCURRENT freed 263K, 43% free 3655K/6343K, external 412K/517K, paused 5ms+4ms
01-29 16:48:49.929: D/dalvikvm(16910): GC_EXTERNAL_ALLOC freed 232K, 41% free 3784K/6407K, external 437K/517K, paused 53ms
01-29 16:48:50.476: D/libEGL(16910): loaded /system/lib/egl/libGLES_hgl.so
01-29 16:48:50.609: D/dalvikvm(16910): GC_CONCURRENT freed 199K, 40% free 3933K/6535K, external 550K/1036K, paused 23ms+4ms
01-29 16:48:50.632: E/(16910): Creating OpenGL 1.1 Session
01-29 16:48:50.632: D/BRCM_EGL(16910): eglCreateContext() context: 0xf0920, VC context 1, Thread 16929
01-29 16:48:50.640: D/BRCM_EGL(16910): eglCreateWindowSurface() surface: 0x1e56e0, VC surface: 1, Thread: 16929
01-29 16:48:50.640: D/BRCM_EGL(16910): eglMakeCurrent(0xf0920, 0x1e56e0, 0x1e56e0) Thread: 16929

manifest.xml

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

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

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<!-- Required OpenGL ES 2.0. for Maps V2 -->
<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="com.vallabh.googlemapspractice.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="My API key here"/>


</application>

</manifest>

Activity.java

package com.vallabh.googlemapspractice;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.SupportMapFragment;

import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends FragmentActivity 
{
GoogleMap map;
double lat;
double lan;
boolean flag = false;

@Override
protected void onCreate(Bundle onSavedInstanceState) 
{
    super.onCreate(onSavedInstanceState);
    setContentView(R.layout.activity_main);
    map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
}

}

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"
tools:context=".MainActivity" 
android:orientation="vertical">

<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent" />

</LinearLayout>
like image 820
Vallabh Lakade Avatar asked Jan 29 '14 11:01

Vallabh Lakade


2 Answers

I had same issue turn out that Google Map APi was enabled on project console . make sure Google Map API is enabled .Enable map API

like image 88
Hitesh Sahu Avatar answered Oct 13 '22 00:10

Hitesh Sahu


Add this tag before the uses-permision tags in the AndroidManifest file:

<permission
    android:name="com.vallabh.googlemapspractice.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

And add this uses-permission tag:

<uses-permission android:name="com.vallabh.googlemapspractice.permission.MAPS_RECEIVE" />
like image 26
Gabriel Volpe Avatar answered Oct 12 '22 23:10

Gabriel Volpe