尝试设置 Google Maps v2 时,我不断收到
无法解析 Lcom/alpha/dealtap/Map 的超类;(40)
java.lang.RuntimeException:无法在loaderdalvik中实例化活动ComponentInfo{com.alpha.dealtap/com.alpha.dealtap.Map}:java.lang.ClassNotFoundException:com.alpha.dealtap.Map。loaderdalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.alpha.dealtap-1.apk
显现
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.alpha.dealtap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission
android:name="com.alpha.dealtap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="dealtap.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" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE"/> -->
<!-- This might be the problem......The Google code produces an error -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/dealtap_text"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name="com.alpha.dealtap.Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.alpha.dealtap.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.alpha.dealtap.Search_Page"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.alpha.dealtap.SEARCH_PAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.alpha.dealtap.DealPage"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.alpha.dealtap.DEALPAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.alpha.dealtap.StorePage"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.alpha.dealtap.STOREPAGE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.alpha.dealtap.Map"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.alpha.dealtap.MAP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.alpha.dealtap.TapDeal"
android:label="TapDeal"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="com.alpha.dealtap.TAPDEAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Took it out for privacy" />
</application>
</manifest>
地图.Java
package com.alpha.dealtap;
import com.alpha.dealtap.R;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class Map extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
}
}
地图.xml
<?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="wrap_content"
android:background="@color/white" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
我遵循了 Google 开发流程和一些教程,但没有找到答案
谢谢!
新的 LogCat
06-09 14:11:30.552: E/AndroidRuntime(11833): 致命异常: main 06-09 14:11:30.552: E/AndroidRuntime(11833): java.lang.RuntimeException: 无法启动活动 ComponentInfo{com. alpha.dealtap/com.alpha.dealtap.Map}:android.view.InflateException:二进制 XML 文件第 7 行:膨胀类片段时出错 06-09 14:11:30.552:E/AndroidRuntime(11833):在 android.app .ActivityThread.performLaunchActivity(ActivityThread.java:1696) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716) 06-09 14:11:30.552 : E/AndroidRuntime(11833): 在 android.app.ActivityThread.access$1500(ActivityThread.java:124) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.app.ActivityThread$H.handleMessage (ActivityThread.java:968) 06-09 14:11:30.552: E/AndroidRuntime(11833):在 android.os.Handler.dispatchMessage(Handler.java:99) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.os.Looper.loop(Looper.java:130) 06-09 14 :11:30.552: E/AndroidRuntime(11833): 在 android.app.ActivityThread.main(ActivityThread.java:3806) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 java.lang.reflect。 Method.invokeNative(Native Method) 06-09 14:11:30.552: E/AndroidRuntime(11833): at java.lang.reflect.Method.invoke(Method.java:507) 06-09 14:11:30.552: E /AndroidRuntime(11833): 在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 com.android.internal。 os.ZygoteInit.main(ZygoteInit.java:597) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 dalvik.system.NativeStart.main(Native Method) 06-09 14:11:30.552:E/AndroidRuntime(11833):原因:android.view.InflateException:二进制 XML 文件第 7 行:膨胀类片段时出错 06-09 14:11:30.552:E/AndroidRuntime(11833):在 android.view.LayoutInflater。 createViewFromTag(LayoutInflater.java:587) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 06-09 14:11:30.552: E/ AndroidRuntime(11833): 在 android.view.LayoutInflater.inflate(LayoutInflater.java:408) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.view.LayoutInflater.inflate(LayoutInflater.java:320 ) 06-09 14:11:30.552: E/AndroidRuntime(11833): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 06-09 14:11:30.552: E/AndroidRuntime(11833): at com .android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256) 06-09 14:11:30。552: E/AndroidRuntime(11833): 在 android.app.Activity.setContentView(Activity.java:1703) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 com.alpha.dealtap.Map.onCreate (Map.java:13) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-09 14:11:30.552: E/AndroidRuntime (11833): 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1660) 06-09 14:11:30.552: E/AndroidRuntime(11833): ... 11 更多 06-09 14:11:30.552: E /AndroidRuntime(11833):原因:android.support.v4.app.Fragment$InstantiationException:无法实例化片段 com.google.android.gms.maps.SupportMapFragment:确保类名存在、公开且为空公共构造函数 06-09 14:11:30.552: E/AndroidRuntime(11833): at android.support.v4.app.Fragment.instantiate(Fragment.java:401) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.support.v4.app.Fragment.instantiate(Fragment.java:369) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 android .view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 06-09 14:11:30.552: E/AndroidRuntime(11833): ... 20 更多 06-09 14:11:30.552: E/AndroidRuntime(11833):引起:java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment in loader dalvik.system.PathClassLoader[/data/app/com.alpha.dealtap-2.apk] 06-09 14:11: 30.552: E/AndroidRuntime(11833): 在 dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) 06-09 14:11:30.552: E/AndroidRuntime(11833):在 java.lang.ClassLoader.loadClass(ClassLoader.java:551) 06-09 14:11:30.552: E/AndroidRuntime(11833): 在 java.lang.ClassLoader.loadClass(ClassLoader.java:511) 06-09 14 :11:30.552: E/AndroidRuntime(11833): 在 android.support.v4.app.Fragment.instantiate(Fragment.java:391)