Blank Screen Android 2.2 Google Maps V2
Solution 1:
http://i.imgur.com/ht0CQwT.png See the snapshot. You did not add Google Play Services library that is require for displaying Google Android Map V2. Please download and add that library and then try again.
Please also see the target. Your target is 4.2.2 and your are accessing it on 2.2. Change the target to 2.2 and use support fragment.
Thanks,
Solution 2:
I have solved this issue,
- Open your Google APIs Console
- Choose API Access
- Edit allowed Android apps from your API Key
- Change the package name with your package name
- Example: 00:06:A5:0E:04:A2:1E:8F:FE:6B:7F:46:23:C3:xx:xx:xx:xx:xx:xx;com.example.androidmapview
Solution 3:
You are missing permissions and meta-data for API KEY.
Read this carefully: https://developers.google.com/maps/documentation/android/start
Solution 4:
Working with android mapapi v2 ,the main reason is you must add play service to your app,like below :
<permissionandroid:name="com.example.androidmapview.permission.MAPS_RECEIVE"android:protectionLevel="signature" /><uses-permissionandroid:name="com.example.androidmapview.permission.MAPS_RECEIVE" />
Use fragment class in Layout:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"class="com.google.android.gms.maps.SupportMapFragment"/>
And change your manifest:
<?xml version="1.0" encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"package="com.example.androidmapview"android:versionCode="1"android:versionName="1.0" ><uses-sdkandroid:minSdkVersion="8"android:targetSdkVersion="16" /><permissionandroid:name="com.example.androidmapview.permission.MAPS_RECEIVE"android:protectionLevel="signature" /><uses-permissionandroid:name="com.example.androidmapview.permission.MAPS_RECEIVE" /><uses-permissionandroid:name="android.permission.INTERNET" /><uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE" /><uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION" /><uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION" /><uses-permissionandroid:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /><applicationandroid:allowBackup="true"android:icon="@drawable/ic_launcher"android:label="@string/app_name"android:theme="@style/AppTheme" ><activityandroid:name="com.example.androidmapview.MainActivity"android:label="@string/app_name" ><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity><meta-dataandroid:name="com.google.android.maps.v2.API_KEY"android:value="AIzxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"></meta-data></application><uses-featureandroid:glEsVersion="0x00020000"android:required="true" /></manifest>
in activity:
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
publicclassMainActivityextendsFragmentActivity {
@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SupportMapFragmentfragment=newSupportMapFragment();
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, fragment).commit();
}
}
For more info check the link which will explain you in details about api v2
Solution 5:
I solved my blank screen problem with zoom in/out buttons like that.(it happens after I changed my package name)
- Delete the keystore file
- Create a new keystore file
- Get SHA1 fingerprint
- Go to API Console
- Create a new Android App.
- Paste your fingerprint
- Use the given API Key in your Manifest File
That worked for me
Post a Comment for "Blank Screen Android 2.2 Google Maps V2"