Android Google Map API V2 - Error Inflating Class Fragment - android

I have been following Googles guide to making an app that allows you to view an app on an Android phone. I have followed many tutorials, but always end up with the same error! I have also searched around the web and figured my error is something to do with the "fragment". Here are my files:
MainActivity.java
package com.example.theapp;
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"/>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.theapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<permission
android:name="com.example.theapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.theapp.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<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"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="--REMOVED--"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.theapp.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" />
</application>
I am using Android 2.3. Here is the log cat messages:
04-02 22:43:45.890: D/AndroidRuntime(23773): Shutting down VM
04-02 22:43:45.890: W/dalvikvm(23773): threadid=1: thread exiting with uncaught exception (group=0x40018578)
04-02 22:43:45.898: E/AndroidRuntime(23773): FATAL EXCEPTION: main
04-02 22:43:45.898: E/AndroidRuntime(23773): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.theapp/com.example.theapp.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.os.Looper.loop(Looper.java:130)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.main(ActivityThread.java:3687)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.reflect.Method.invoke(Method.java:507)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-02 22:43:45.898: E/AndroidRuntime(23773): at dalvik.system.NativeStart.main(Native Method)
04-02 22:43:45.898: E/AndroidRuntime(23773): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.Activity.setContentView(Activity.java:1657)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.example.theapp.MainActivity.onCreate(MainActivity.java:11)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-02 22:43:45.898: E/AndroidRuntime(23773): ... 11 more
04-02 22:43:45.898: E/AndroidRuntime(23773): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.theapp-1.apk]
04-02 22:43:45.898: E/AndroidRuntime(23773): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-02 22:43:45.898: E/AndroidRuntime(23773): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
04-02 22:43:45.898: E/AndroidRuntime(23773): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
04-02 22:43:45.898: E/AndroidRuntime(23773): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-02 22:43:45.898: E/AndroidRuntime(23773): ... 19 more
04-02 22:55:53.289: D/AndroidRuntime(23942): Shutting down VM
04-02 22:55:53.289: W/dalvikvm(23942): threadid=1: thread exiting with uncaught exception (group=0x40018578)
04-02 22:55:53.304: E/AndroidRuntime(23942): FATAL EXCEPTION: main
04-02 22:55:53.304: E/AndroidRuntime(23942): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.theapp/com.example.theapp.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.os.Looper.loop(Looper.java:130)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.main(ActivityThread.java:3687)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.reflect.Method.invoke(Method.java:507)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-02 22:55:53.304: E/AndroidRuntime(23942): at dalvik.system.NativeStart.main(Native Method)
04-02 22:55:53.304: E/AndroidRuntime(23942): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:209)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.Activity.setContentView(Activity.java:1657)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.example.theapp.MainActivity.onCreate(MainActivity.java:11)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-02 22:55:53.304: E/AndroidRuntime(23942): ... 11 more
04-02 22:55:53.304: E/AndroidRuntime(23942): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.theapp-2.apk]
04-02 22:55:53.304: E/AndroidRuntime(23942): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
04-02 22:55:53.304: E/AndroidRuntime(23942): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.createView(LayoutInflater.java:471)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
04-02 22:55:53.304: E/AndroidRuntime(23942): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
04-02 22:55:53.304: E/AndroidRuntime(23942): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-02 22:55:53.304: E/AndroidRuntime(23942): ... 19 more
Any help would be appreciated. Thank you in advance.

package com.example.theapp;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
and in manifest add one more meta tag below previous one.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Api key" />

As far as I remember, You should include android-support-v4.jar file from Android SDK folder "sdk/extras/android/support/v4/android-support-v4.jar". If You dont have that file, in Your SDK Manager install Android Support Library, which is found under Extras.

Please check the following steps:
In android manifest you have the NETWORK STATE permission like this
< uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
In android manifest make sure you have the following code as well-
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value=" YOUR KEY HERE" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Lastly if you are testing your application on android API 5.x then make sure you modify your map code like this-
Instead of this
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
write this
map = getMapFragment().getMap();
and add a small method like this
private MapFragment getMapFragment() {
FragmentManager fm = null;
Log.d("", "sdk: " + Build.VERSION.SDK_INT);
Log.d("", "release: " + Build.VERSION.RELEASE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Log.d("", "using getFragmentManager");
fm = getFragmentManager();
} else {
Log.d("", "using getChildFragmentManager");
fm = getChildFragmentManager();
}
return (MapFragment) fm.findFragmentById(R.id.map);
}
And make sure for step 3 your min sdk version in your manifest file is 17 like this
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21" />

Related

Android Google Map error, Unable to start activity ComponentInfo

I have tried a small example in Google map. I have got the API key but when I run the project, it displays the following errors. I have also imported Google play services.
My XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
My Java
package com.arun.maps;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.widget.Toast;
public class GoogleMapS extends FragmentActivity {
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.google_map);
try {
// Loading map
initilizeMap();
} catch (Exception e) {
e.printStackTrace();
}
}
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
}
#Override
protected void onResume() {
super.onResume();
initilizeMap();
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.google_map, menu);
return true;
}
}
Android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arun.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- 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" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.arun.maps.GoogleMapS"
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.maps.v2.API_KEY"
android:value="
AIzaSyBn3b2eGABl1JL-xXKe1H_uf4UtPRUUAwY" />
</application>
</manifest>
Error:
04-02 17:21:39.355: E/AndroidRuntime(719): FATAL EXCEPTION: main
04-02 17:21:39.355: E/AndroidRuntime(719): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.arun.maps/com.arun.maps.GoogleMapS}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.os.Looper.loop(Looper.java:130)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-02 17:21:39.355: E/AndroidRuntime(719): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 17:21:39.355: E/AndroidRuntime(719): at java.lang.reflect.Method.invoke(Method.java:507)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-02 17:21:39.355: E/AndroidRuntime(719): at dalvik.system.NativeStart.main(Native Method)
04-02 17:21:39.355: E/AndroidRuntime(719): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.Activity.setContentView(Activity.java:1657)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.arun.maps.GoogleMapS.onCreate(GoogleMapS.java:16)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-02 17:21:39.355: E/AndroidRuntime(719): ... 11 more
04-02 17:21:39.355: E/AndroidRuntime(719): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4323000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.common.GooglePlayServicesUtil.t(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.internal.q.B(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.internal.q.A(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.SupportMapFragment$b.gW(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.dynamic.a.a(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:290)
04-02 17:21:39.355: E/AndroidRuntime(719): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-02 17:21:39.355: E/AndroidRuntime(719): ... 20 more
Add this in manifest file's application tag.
<!-- Required after latest Google Play Services update -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Add this in manifest file inside your application tag:
<meta-data
android:name="com.google.android.gms.version"
android:value="4242000" />

App crashes after setting to Theme.NoTitleBar.Fullscreen

My app will start if I don't take away the title bar but when I do it crashes as soon as it starts.
This is the code I have so far.
?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.v1.solitare"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<activity
android:name="com.v1.solitare.MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Please help in any way possible. I just picked up Android coding with Eclipse today and I'm very new at it.
Edit: I think I found the LogCat Errors for it:
04-02 22:06:28.986: E/AndroidRuntime(28352): FATAL EXCEPTION: main
04-02 22:06:28.986: E/AndroidRuntime(28352): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.v1.solitare/com.v1.solitare.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2359)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.access$700(ActivityThread.java:165)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1326)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.os.Looper.loop(Looper.java:137)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.main(ActivityThread.java:5455)
04-02 22:06:28.986: E/AndroidRuntime(28352): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 22:06:28.986: E/AndroidRuntime(28352): at java.lang.reflect.Method.invoke(Method.java:525)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
04-02 22:06:28.986: E/AndroidRuntime(28352): at dalvik.system.NativeStart.main(Native Method)
04-02 22:06:28.986: E/AndroidRuntime(28352): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:111)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
04-02 22:06:28.986: E/AndroidRuntime(28352): at com.v1.solitare.MainActivity.onCreate(MainActivity.java:18)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.Activity.performCreate(Activity.java:5372)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
04-02 22:06:28.986: E/AndroidRuntime(28352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2267)
04-02 22:06:28.986: E/AndroidRuntime(28352): ... 11 more
ActionBarActivity assumes you are using an ActionBar, while Theme.NoTitleBar themes remove the ActionBar (as that is part of the title bar on newer devices and ActionBarActivity assumes you are using a Theme.AppCompat theme which controls styling for the ActionBar).
Change your activity to extend FragmentActivity if you are okay with not having an Action Bar, although as per the Android design docs is a critical component for making your app feel like an Android app (although some would say that games are granted more leeway).

Binary XML file line #18: Error inflating class fragment in Google Maps Sample

I just download the ADT Bundle, update the eclipse plugin, update the extras and tools folder from the sdk, import google play services and google maps sample from the sdk I have this error
04-02 13:49:26.031: E/AndroidRuntime(11469): FATAL EXCEPTION: main
04-02 13:49:26.031: E/AndroidRuntime(11469): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapdemo/com.example.mapdemo.BasicMapDemoActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.access$600(ActivityThread.java:140)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.os.Handler.dispatchMessage(Handler.java:99)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.os.Looper.loop(Looper.java:137)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.main(ActivityThread.java:4895)
04-02 13:49:26.031: E/AndroidRuntime(11469): at java.lang.reflect.Method.invokeNative(Native Method)
04-02 13:49:26.031: E/AndroidRuntime(11469): at java.lang.reflect.Method.invoke(Method.java:511)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
04-02 13:49:26.031: E/AndroidRuntime(11469): at dalvik.system.NativeStart.main(Native Method)
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.Activity.setContentView(Activity.java:1912)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.example.mapdemo.BasicMapDemoActivity.onCreate(BasicMapDemoActivity.java:42)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.Activity.performCreate(Activity.java:5163)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 11 more
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/maps_popup_pointer_button.xml from drawable resource ID #0x7f0201b7
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadDrawable(Resources.java:1951)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.getDrawable(Resources.java:672)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.bm.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.al.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.bh.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at maps.e.bg.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at etu.onTransact(SourceFile:107)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.os.Binder.transact(Binder.java:326)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.dynamic.a$4.b(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.dynamic.a.a(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.dynamic.a.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 20 more
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/maps_popup_pointer_button.xml from xml type drawable resource ID #0x7f0201b7
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2178)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadDrawable(Resources.java:1946)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 39 more
04-02 13:49:26.031: E/AndroidRuntime(11469): Caused by: java.io.FileNotFoundException: res/drawable/maps_popup_pointer_button.xml
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
04-02 13:49:26.031: E/AndroidRuntime(11469): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2160)
04-02 13:49:26.031: E/AndroidRuntime(11469): ... 40 more
04-02 13:49:26.062: E/android.os.Debug(307): !#Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
Some folder from the proyect and lib configuration
https://www.dropbox.com/sh/12sksspx5a42bnq/lNUKGtsUgI#/
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo"
android:versionCode="6"
android:versionName="2.7.0">
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17"/>
<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"/>
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<!-- End of copy. -->
<application
android:icon="#drawable/ic_launcher"
android:label="#string/demo_title"
android:hardwareAccelerated="true">
<!-- ** You need to replace the key below with your own key. **
The example key below will not be accepted because it is not linked to the
certificate which you will use to sign this application.
See: https://developers.google.com/maps/documentation/android/start
for instructions on how to get your own key. -->
<meta-data android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCvGBr5in13NK2********Ttnxj3mrXQy4"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".LegalInfoActivity"
android:label="#string/legal_info"/>
<activity
android:name=".BasicMapDemoActivity"
android:label="#string/basic_map_demo_label"/>
<activity
android:name=".CameraDemoActivity"
android:label="#string/camera_demo_label"/>
<activity
android:name=".CircleDemoActivity"
android:label="#string/circle_demo_label"/>
<activity
android:name=".EventsDemoActivity"
android:label="#string/events_demo_label"/>
<activity
android:name=".GroundOverlayDemoActivity"
android:label="#string/ground_overlay_demo_label"/>
<activity
android:name=".LayersDemoActivity"
android:label="#string/layers_demo_label"/>
<activity
android:name=".LocationSourceDemoActivity"
android:label="#string/location_source_demo_label"/>
<activity
android:name=".MapInPagerDemoActivity"
android:label="#string/map_in_pager_demo_label"/>
<activity
android:name=".MarkerDemoActivity"
android:label="#string/marker_demo_label"/>
<activity
android:name=".MultiMapDemoActivity"
android:label="#string/multi_map_demo_label"/>
<activity
android:name=".MyLocationDemoActivity"
android:label="#string/my_location_demo_label"/>
<activity
android:name=".OptionsDemoActivity"
android:label="#string/options_demo_label"/>
<activity
android:name=".PolygonDemoActivity"
android:label="#string/polygon_demo_label"/>
<activity
android:name=".PolylineDemoActivity"
android:label="#string/polyline_demo_label"/>
<activity
android:name=".ProgrammaticDemoActivity"
android:label="#string/programmatic_demo_label"/>
<activity
android:name=".RawMapViewDemoActivity"
android:label="#string/raw_map_view_demo_label"/>
<activity
android:name=".RetainMapDemoActivity"
android:label="#string/retain_map_demo_label"/>
<activity
android:name=".SaveStateDemoActivity"
android:label="#string/save_state_demo_label"/>
<activity
android:name=".SnapshotDemoActivity"
android:label="#string/snapshot_demo_label"/>
<activity
android:name=".TileCoordinateDemoActivity"
android:label="#string/tile_coordinate_demo_label"/>
<activity
android:name=".TileOverlayDemoActivity"
android:label="#string/tile_overlay_demo_label"/>
<activity
android:name=".UiSettingsDemoActivity"
android:label="#string/ui_settings_demo_label"/>
<activity
android:name=".VisibleRegionDemoActivity"
android:label="#string/visible_region_demo_label"/>
</application>
</manifest>
the layout
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- This can go anywhere in your layout (see other demos for some examples). -->
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
If a create the map via Java like this
mapaVirtual = SupportMapFragment.newInstance();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.map, mapaVirtual, "TAG");
ft.commit();
mapaVirtual = new SupportMapFragment()
{
#Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
GoogleMap map = mapaVirtual.getMap();
if (map != null)
{
mapa = mapaVirtual.getMap();
mapa.setMyLocationEnabled(true);
mapa.setOnInfoWindowClickListener(new OnInfoWindowClickListener()
{
#Override
public void onInfoWindowClick(Marker marker)
{
}
});
mapa.setOnMarkerClickListener(new OnMarkerClickListener()
{
public boolean onMarkerClick(Marker marker)
{
return false;
}
});
}
}
};
Same error
UPDATE
Some testing
Samsung G3 - Mini with 4.1.2 Google Play services client version: 3159100 > Works
Samsung Galaxy Tab 2 7.0 with 4.1.1 Google Play services cliente version: 3159100 > Not works

Vibrator.vibrate(long) causing frequent application restarts on LG-E730

If I am using the Vibrator.vibrate(long) on an LG-E370 this is causing frequent application restarts. The vibrator permission has been added to the manifest and the vibrator vibrates up to 5 times before the app is restarting.
How can I vibrate reliably?
I added the output of a stacktrace to my onPause() and this is what I get:
04-02 14:39:36.384: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:36.384: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:36.384: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:36.384: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:36.384: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:36.424: android.app.ActivityThread.performNewIntents(ActivityThread.java:1747)
04-02 14:39:36.424: android.app.ActivityThread.handleNewIntent(ActivityThread.java:1757)
04-02 14:39:36.424: android.app.ActivityThread.access$2300(ActivityThread.java:117)
04-02 14:39:36.424: android.app.ActivityThread$H.handleMessage(ActivityThread.java:989)
04-02 14:39:36.424: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:36.434: android.os.Looper.loop(Looper.java:130)
04-02 14:39:36.434: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:36.434: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:36.434: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:36.444: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:36.444: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:36.444: dalvik.system.NativeStart.main(Native Method)
04-02 14:39:44.351: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:44.371: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:44.371: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:44.371: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:44.381: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:44.381: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2356)
04-02 14:39:44.381: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)
04-02 14:39:44.381: android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2818)
04-02 14:39:44.401: android.app.ActivityThread.access$1600(ActivityThread.java:117)
04-02 14:39:44.401: android.app.ActivityThread$H.handleMessage(ActivityThread.java:946)
04-02 14:39:44.411: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:44.411: android.os.Looper.loop(Looper.java:130)
04-02 14:39:44.411: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:44.462: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:44.462: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:44.462: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:44.482: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:44.492: dalvik.system.NativeStart.main(Native Method)
04-02 14:39:44.772: W/ServerManager(8731): <!>com.evotegra.aCoDriver.data.ServerManager$ConnectionManager 559<!> Connection thread was interrupted. Message: null
04-02 14:39:44.862: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:44.862: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:44.862: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:44.862: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:44.862: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:44.862: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2356)
04-02 14:39:44.862: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)
04-02 14:39:44.862: android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2818)
04-02 14:39:44.872: android.app.ActivityThread.access$1600(ActivityThread.java:117)
04-02 14:39:44.872: android.app.ActivityThread$H.handleMessage(ActivityThread.java:946)
04-02 14:39:44.872: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:44.872: android.os.Looper.loop(Looper.java:130)
04-02 14:39:44.872: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:44.872: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:44.872: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:44.872: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:44.872: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:44.872: dalvik.system.NativeStart.main(Native Method)
04-02 14:39:48.315: dalvik.system.VMStack.getThreadStackTrace(Native Method)
04-02 14:39:48.315: java.lang.Thread.getStackTrace(Thread.java:737)
04-02 14:39:48.315: com.evotegra.aCoDriver.ACoDriverActivity.onPause(ACoDriverActivity.java:94)
04-02 14:39:48.315: android.app.Activity.performPause(Activity.java:3851)
04-02 14:39:48.315: android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
04-02 14:39:48.325: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2356)
04-02 14:39:48.335: android.app.ActivityThread.performPauseActivity(ActivityThread.java:2326)
04-02 14:39:48.345: android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2306)
04-02 14:39:48.345: android.app.ActivityThread.access$1700(ActivityThread.java:117)
04-02 14:39:48.345: android.app.ActivityThread$H.handleMessage(ActivityThread.java:953)
04-02 14:39:48.355: android.os.Handler.dispatchMessage(Handler.java:99)
04-02 14:39:48.355: android.os.Looper.loop(Looper.java:130)
04-02 14:39:48.355: android.app.ActivityThread.main(ActivityThread.java:3740)
04-02 14:39:48.355: java.lang.reflect.Method.invokeNative(Native Method)
04-02 14:39:48.375: java.lang.reflect.Method.invoke(Method.java:507)
04-02 14:39:48.375: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
04-02 14:39:48.375: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)
04-02 14:39:48.385: dalvik.system.NativeStart.main(Native Method)

Google Maps Android API v2 and Eclipse

I am new in Google Map and so many things aren't clear enough to me for that reason.So i expect some expert's direction on this regard.I read This Guide and did everything what it says.I use google map api v2 and get a map key.Then i make a sample project following that link and select target version android 2.2(while running the project).But a list of error occurs after running then example in eclipse android emulator.My logcat view shows:
01-31 00:51:59.226: W/dalvikvm(329): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
01-31 00:51:59.236: E/AndroidRuntime(329): FATAL EXCEPTION: main
01-31 00:51:59.236: E/AndroidRuntime(329): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.googleMapApp/com.googleMapApp.LocationProfileManagerActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.os.Looper.loop(Looper.java:123)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.reflect.Method.invokeNative(Native Method)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.reflect.Method.invoke(Method.java:521)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-31 00:51:59.236: E/AndroidRuntime(329): at dalvik.system.NativeStart.main(Native Method)
01-31 00:51:59.236: E/AndroidRuntime(329): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.Activity.setContentView(Activity.java:1647)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.googleMapApp.LocationProfileManagerActivity.onCreate(LocationProfileManagerActivity.java:14)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-31 00:51:59.236: E/AndroidRuntime(329): ... 11 more
01-31 00:51:59.236: E/AndroidRuntime(329): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.googleMapApp-1.apk]
01-31 00:51:59.236: E/AndroidRuntime(329): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-31 00:51:59.236: E/AndroidRuntime(329): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
01-31 00:51:59.236: E/AndroidRuntime(329): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
01-31 00:51:59.236: E/AndroidRuntime(329): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
My Manifest.xml is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googleMapApp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<permission
android:name="com.googleMapApp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.googleMapApp.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Require OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".LocationProfileManagerActivity"
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.maps.v2.API_KEY"
android:value="myMapKey"/>
</application>
</manifest>
My main.xml is:
<?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"
class="com.google.android.gms.maps.MapFragment"/>
My activity.java is:
package com.googleMapApp;
import android.app.Activity;
import android.os.Bundle;
public class LocationProfileManagerActivity extends Activity {
/** Called when the activity is first created. */
//private GoogleMap map;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}
}
Sorry for this lengthy description,but i want to show you exactly what i did.I think as a newcomer i did a lot of mistake on this way.so i expect someone will guide me that.
You are using features only available in later APIs, namely Fragment. If you want to compile to support 2.2, you need to include the Support Library in your project. You will also have to make the following changes to use support fragments instead of regular fragments --
In main.xml, change
class="com.google.android.gms.maps.MapFragment"/>
to
class="com.google.android.gms.maps.SupportMapFragment"/>
and in your activity.java, change
public class LocationProfileManagerActivity extends Activity {
to
public class LocationProfileManagerActivity extends FragmentActivity {
you need to make two changes
Since as you are sdk version is below 12, need to make following change
1)
main.xml
Replace
class="com.google.android.gms.maps.MapFragment"/>
with
class="com.google.android.gms.maps.SupportMapFragment"/>
2) activity.java
Need to extend FragmentActivity instead of Activity
If you want to test in emulator , then download the google_play_services_apk and install it in emulator.
Maps API v2 cannot be run in an emulator because of its dependency on Google Play Services, which is bundled in the Google Play Store .apk. It can be hacked together though, you can read about it here on the first Google result for "Google maps v2 emulator". Also you can still use V1 for a limited time, you can get started here.

Categories

Resources