Sms Gratis Indosat

Phone Numbers
0 -
Example : 83832867987 Without 0

Type your Messages

Question: + =

Google Maps Android API v2 with blank map displayed, wrong API Key assigned.

If you use Google Maps Android API v2, but with a blank (gray) map displayed (like the screen shown below), and "E/Google Maps Android API(12676): Authorization failure" reported in LogCat; may be caused by a wrong API Key assigned.

Google Maps Android API v2 with blank map displayed, wrong API Key assigned.


In order to use Maps Android API, you have to assign a API Key in AndroidManifest.xml.
        <meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your API Key here"/>


You have to assign Debug API Key in testing, and Release API Key when release APK. Just insert the correct API Key, clean and rebuild your project should be OK. It's suggested to un-install your old app in device before re-load.



The series:
A simple example using Google Maps Android API v2, step by step.

Using SupportMapFragment

The post "A simple example using Google Maps Android API v2" using com.google.android.gms.maps.MapFragment. It work on device run API 12 and above. For older API level, using com.google.android.gms.maps.SupportMapFragment.

SupportMapFragment on Nexus One running Android 2.3.6


Modify layout to replace com.google.android.gms.maps.MapFragment with com.google.android.gms.maps.SupportMapFragment.
<RelativeLayout 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" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world" />
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>

</RelativeLayout>


Modify main code to extend android.support.v4.app.FragmentActivity, rather than Activity. Otherwise, AndroidRuntime will be Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader.
package com.example.androidmapsv2;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

}



The series:
A simple example using Google Maps Android API v2, step by step.

+1000

Finally get +1000 at the day of End of the World:)


Turn off Lint Error Checking

After you finished coding with Google Maps Android API v2, and going to Export Signed Application Package (Right click your project -> Android Tools -> Export Signed Application Package...), MAY BE Export will be aborted because fetal lint errors were found, caused by something like:

"common_google_play_services_unknown_issue" is not translated...

lint error

It can be solved by turn off Run full error check.

Click Window in Eclipse, select Preferences.

Select Android -> Lint Error Checking on the left, and turn off "Run full error check when exporting app and abort if errors are found"


Then, you can clean and re-build your project.


The series:
A simple example using Google Maps Android API v2, step by step.

 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy