I've searched for a week and tested all the solutions said, but nonestrong text worked! I've tried every thing said in:
Google Maps Android API v2 - Getting Started
and lot's of others SO solutions...
I tried to test on my Mobile Phone but it crashes in start.
Main Activity:
package com.google.balakharekechi;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
and the Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.balakharekechi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<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" >
<activity
android:name=".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="AIzaSyB_Exrzd7O0rzadCpWMvk6hdz5QUJx9DTk" />
</application>
there is no error...
i've tried with google-play-servies 6171000 and 5077000 same problem.
tried extends FragmentActivity also and the same problem...
the Log Cat with a Google Nexus 4-4.4.4 simulation on GenyMotion:
01-12 15:30:34.240: D/libEGL(1869): loaded /system/lib/egl/libEGL_genymotion.so
01-12 15:30:34.244: D/(1869): HostConnection::get() New Host Connection established 0xb8ee21c0, tid 1869
01-12 15:30:34.268: D/libEGL(1869): loaded /system/lib/egl/libGLESv1_CM_genymotion.so
01-12 15:30:34.268: D/libEGL(1869): loaded /system/lib/egl/libGLESv2_genymotion.so
01-12 15:30:34.340: W/EGL_genymotion(1869): eglSurfaceAttrib not implemented
01-12 15:30:34.344: E/OpenGLRenderer(1869): Getting MAX_TEXTURE_SIZE from GradienCache
01-12 15:30:34.344: E/OpenGLRenderer(1869): MAX_TEXTURE_SIZE: 16384
01-12 15:30:34.360: E/OpenGLRenderer(1869): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
01-12 15:30:34.364: E/OpenGLRenderer(1869): MAX_TEXTURE_SIZE: 16384
01-12 15:30:34.364: D/OpenGLRenderer(1869): Enabling debug mode 0
01-12 15:30:37.400: W/GooglePlayServicesUtil(1869): Google Play services out of date. Requires 5077000 but found 2012110
01-12 15:30:37.408: W/GooglePlayServicesUtil(1869): Google Play services out of date. Requires 5077000 but found 2012110
and on my real mobile phone, crashes after some seconds...
these are LogCat Errors of my real device debugging:
01-17 14:26:18.491: E/AndroidRuntime(24322): FATAL EXCEPTION: main
01-17 14:26:18.491: E/AndroidRuntime(24322): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.balakharekechi/com.google.balakharekechi.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2377)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.ActivityThread.access$600(ActivityThread.java:167)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.os.Handler.dispatchMessage(Handler.java:99)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.os.Looper.loop(Looper.java:153)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.ActivityThread.main(ActivityThread.java:5341)
01-17 14:26:18.491: E/AndroidRuntime(24322): at java.lang.reflect.Method.invokeNative(Native Method)
01-17 14:26:18.491: E/AndroidRuntime(24322): at java.lang.reflect.Method.invoke(Method.java:511)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:929)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)
01-17 14:26:18.491: E/AndroidRuntime(24322): at dalvik.system.NativeStart.main(Native Method)
01-17 14:26:18.491: E/AndroidRuntime(24322): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.Activity.setContentView(Activity.java:1884)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.balakharekechi.MainActivity.onCreate(MainActivity.java:19)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.Activity.performCreate(Activity.java:5125)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2289)
01-17 14:26:18.491: E/AndroidRuntime(24322): ... 11 more
01-17 14:26:18.491: E/AndroidRuntime(24322): Caused by: java.lang.SecurityException: The Maps API requires the additional following permissions to be set in the AndroidManifest.xml to ensure a correct behavior:
01-17 14:26:18.491: E/AndroidRuntime(24322): <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.maps.api.android.lib6.c.ck.a(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.maps.api.android.lib6.c.i.a(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.maps.api.android.lib6.c.el.a(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.maps.api.android.lib6.c.ab.a(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.maps.api.android.lib6.c.aa.a(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.maps.internal.x.onTransact(SourceFile:107)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.os.Binder.transact(Binder.java:310)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.dynamic.a$4.b(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.dynamic.a.a(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:920)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1206)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2159)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
01-17 14:26:18.491: E/AndroidRuntime(24322): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
01-17 14:26:18.491: E/AndroidRuntime(24322): ... 20 more
plz help me :(