私はこのチュートリアルhttps://developers.google.com/maps/documentation/android/start をステップバイステップで実行しました。これが私のコードです。コードを実行するとすぐに、エミュレータがクラッシュしますこれが私のコードです
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cics530searsprice"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.example.cics530searsprice.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.cics530searsprice.permission.MAPS_RECEIVE"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<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"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.cics530searsprice.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.maps.v2.API_KEY"
android:value="I PUT MY KEY HERE!!!"/>
</application>
</manifest>
私のXMLファイル:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="@+id/price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Advanced search " />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="72dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/http"
android:layout_width="match_parent"
android:layout_height="136dp"
android:text="please wait--- price of the product Loading" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ratings"
android:textAppearance="?android:attr/textAppearanceSmall" />
<RatingBar
android:id="@+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stepSize="3" />
<Button
android:id="@+id/location"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Search Location" />
<Button
android:id="@+id/shoppingprice"
android:layout_width="326dp"
android:layout_height="match_parent"
android:text="Shopping Price"
android:visibility="invisible"
/>
<Button
android:id="@+id/exit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Close" />
<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"/>
</LinearLayout>
LOgcat:
03-08 01:20:13.478: D/AndroidRuntime(302): Shutting down VM
03-08 01:20:13.478: W/dalvikvm(302): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-08 01:20:13.509: E/AndroidRuntime(302): FATAL EXCEPTION: main
03-08 01:20:13.509: E/AndroidRuntime(302): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cics530searsprice/com.example.cics530searsprice.MainActivity}: android.view.InflateException: Binary XML file line #67: Error inflating class fragment
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.os.Looper.loop(Looper.java:123)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-08 01:20:13.509: E/AndroidRuntime(302): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 01:20:13.509: E/AndroidRuntime(302): at java.lang.reflect.Method.invoke(Method.java:521)
03-08 01:20:13.509: E/AndroidRuntime(302): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-08 01:20:13.509: E/AndroidRuntime(302): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-08 01:20:13.509: E/AndroidRuntime(302): at dalvik.system.NativeStart.main(Native Method)
03-08 01:20:13.509: E/AndroidRuntime(302): Caused by: android.view.InflateException: Binary XML file line #67: Error inflating class fragment
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
03-08 01:20:13.509: E/AndroidRuntime(302): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.Activity.setContentView(Activity.java:1647)
03-08 01:20:13.509: E/AndroidRuntime(302): at com.example.cics530searsprice.MainActivity.onCreate(MainActivity.java:79)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-08 01:20:13.509: E/AndroidRuntime(302): ... 11 more
03-08 01:20:13.509: E/AndroidRuntime(302): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.cics530searsprice-2.apk]
03-08 01:20:13.509: E/AndroidRuntime(302): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-08 01:20:13.509: E/AndroidRuntime(302): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-08 01:20:13.509: E/AndroidRuntime(302): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.createView(LayoutInflater.java:466)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
03-08 01:20:13.509: E/AndroidRuntime(302): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
03-08 01:20:13.509: E/AndroidRuntime(302): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
03-08 01:20:13.509: E/AndroidRuntime(302): ... 20 more