開発者サイトからこの例を機能させるのに問題があり、立ち往生しています(おそらく単純なもので)ここに私のxmlレイアウトがあります
<?xml version="1.0" encoding="utf-8"?>
<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" >
<fragment
android:id="@+id/map"
class="com.google.android.gms.maps.MapFragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
私の主な活動
package PackageName.AndroidMapsTest;
import android.os.Bundle;
import android.app.Activity;
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_test_1);
}
}
そして私のマニフェスト
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Pakagename.AndroidMapsTest"
android:versionCode="1"
android:versionName="1.0" >
<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" />
<permission
android:name="Pakagename.AndroidMapsTest.permission.MAPS_RECIVE"
android:protectionLevel="signature" />
<uses-permission android:name="Pakagename.AndroidMapsTest.permission.MAPS_RECIVE"/>
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<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="edu.lewisu.cs.shanejmiller.AndroidMapsTest.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="my_api_key" />
</application>
</manifest>
そして、ログ猫から得ているエラーは
java.lang.RunTimeException: Unable to start activity ComponentInfo{packagename.AndroidMapsTest/packagename.AndroidMapsTest.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
私は今、しばらく立ち往生しており、助けていただければ幸いです。前もって感謝します
ログトレース
07-05 22:00:55.633: E/AndroidRuntime(1799): FATAL EXCEPTION: main
07-05 22:00:55.633: E/AndroidRuntime(1799): java.lang.RuntimeException: Unable to start activity ComponentInfo{edu.lewisu.cs.shanejmiller.AndroidMapsTest/edu.lewisu.cs.shanejmiller.AndroidMapsTest.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.os.Looper.loop(Looper.java:137)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.ActivityThread.main(ActivityThread.java:5041)
07-05 22:00:55.633: E/AndroidRuntime(1799): at java.lang.reflect.Method.invokeNative(Native Method)
07-05 22:00:55.633: E/AndroidRuntime(1799): at java.lang.reflect.Method.invoke(Method.java:511)
07-05 22:00:55.633: E/AndroidRuntime(1799): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-05 22:00:55.633: E/AndroidRuntime(1799): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-05 22:00:55.633: E/AndroidRuntime(1799): at dalvik.system.NativeStart.main(Native Method)
07-05 22:00:55.633: E/AndroidRuntime(1799): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
07-05 22:00:55.633: E/AndroidRuntime(1799): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Activity.setContentView(Activity.java:1881)
07-05 22:00:55.633: E/AndroidRuntime(1799): at edu.lewisu.cs.shanejmiller.AndroidMapsTest.MainActivity.onCreate(MainActivity.java:15)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Activity.performCreate(Activity.java:5104)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
07-05 22:00:55.633: E/AndroidRuntime(1799): ... 11 more
07-05 22:00:55.633: E/AndroidRuntime(1799): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Fragment.instantiate(Fragment.java:592)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Fragment.instantiate(Fragment.java:560)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Activity.onCreateView(Activity.java:4709)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
07-05 22:00:55.633: E/AndroidRuntime(1799): ... 21 more
07-05 22:00:55.633: E/AndroidRuntime(1799): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: /data/app/edu.lewisu.cs.shanejmiller.AndroidMapsTest-2.apk
07-05 22:00:55.633: E/AndroidRuntime(1799): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-05 22:00:55.633: E/AndroidRuntime(1799): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-05 22:00:55.633: E/AndroidRuntime(1799): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-05 22:00:55.633: E/AndroidRuntime(1799): at android.app.Fragment.instantiate(Fragment.java:582)
07-05 22:00:55.633: E/AndroidRuntime(1799): ... 24 more