0

Google マップの新しいバージョンを実装しようとしています。Google で書かれた手順を実行しましたが、携帯電話からマップを実行しようとすると、まだエラーが発生します。

ここに私のJavaコードがあります:

package com.example.e_order;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

public class Order_map extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_map);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_order_map, menu);
        return true;
    }

}

そしてここに私のxmlがあります:

<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 xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
    />
</RelativeLayout>

そして私のマニフェスト:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.e_order"
        android:versionCode="1"
        android:versionName="1.0" >

        <permission
    android:name="com.example.e_order.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

        <uses-permission android:name="com.example.e_order.permission.MAPS_RECEIVE" />

        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" />

  <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" />
    <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" />

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
 <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="mykey" /> 

そして、それは私に見えるlogcatです:

04-08 21:08:40.355: E/AndroidRuntime(14147): FATAL EXCEPTION: main
04-08 21:08:40.355: E/AndroidRuntime(14147): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.e_order/com.example.e_order.Order_map}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1968)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.os.Looper.loop(Looper.java:137)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.ActivityThread.main(ActivityThread.java:4507)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at java.lang.reflect.Method.invokeNative(Native Method)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at java.lang.reflect.Method.invoke(Method.java:511)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at dalvik.system.NativeStart.main(Native Method)
04-08 21:08:40.355: E/AndroidRuntime(14147): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:271)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.Activity.setContentView(Activity.java:1835)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at com.example.e_order.Order_map.onCreate(Order_map.java:12)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.Activity.performCreate(Activity.java:4465)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
04-08 21:08:40.355: E/AndroidRuntime(14147):    ... 11 more
04-08 21:08:40.355: E/AndroidRuntime(14147): Caused by: java.lang.NullPointerException: name == null
04-08 21:08:40.355: E/AndroidRuntime(14147):    at java.lang.VMClassLoader.findLoadedClass(Native Method)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:354)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at java.lang.ClassLoader.loadClass(ClassLoader.java:491)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
04-08 21:08:40.355: E/AndroidRuntime(14147):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
04-08 21:08:40.355: E/AndroidRuntime(14147):    ... 21 more

sry 4 ロング クエスト. :)

新しいエラー:

04-08 22:25:47.108: E/AndroidRuntime(19754): FATAL EXCEPTION: main 04-08 22:25:47.108: E/AndroidRuntime(19754): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable 04-08 22:25:47.108: E/AndroidRuntime(19754): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source) 04-08 22:25:47.108: E/AndroidRuntime(19754): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
4

2 に答える 2