samsung s3 mini (4.1.2) で google android maps V2 を使用しようとしていますが、「アプリケーションが予期せず停止しました」というメッセージが表示され続けます。Google API [Android 4.1.2]、Google Play サービス ライブラリ、android-support-v4.jar を含めました。コードは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Test.projecttest"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.Test.projecttest.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.Test.projecttest.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" />
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBjT4hZc4gKo1lyrQ5fwLD_Fz5vWgUQmlA" />
<activity
android:name="com.Test.projecttest.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>
</application>
</manifest>
com.Test.projecttest の MainActivity.java
package com.Test.projecttest;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
res/layout にある 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"
class="com.google.android.gms.maps.SupportMapFragment" />
私のlogcat:
07-19 16:21:46.594: E/AndroidRuntime(5069): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Test.projecttest/com.Test.projecttest.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
07-19 16:21:46.594: E/AndroidRuntime(5069): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
07-19 16:21:46.594: E/AndroidRuntime(5069): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
07-19 16:21:46.594: E/AndroidRuntime(5069): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment