0
我面臨的問題在Android谷歌地圖V2基於應用程序 我跑在我的手機[Android操作系統,V4.2.2(果凍豆)]但出現錯誤。 我將Logcat的源代碼放在下面。 我的手機在Wi-Fi連接,但我認爲問題是在谷歌地圖 請幫助!提前致謝!谷歌地圖V2在Android手機不工作
的logcat:
11-21 06:40:50.672: D/jdwp(7984): sendBufferedRequest : len=0x45
11-21 06:40:50.676: W/asset(7984): AssetManager-->addDefaultAssets CIP path not exsit!
11-21 06:40:50.740: D/AndroidRuntime(7984): Shutting down VM
11-21 06:40:50.741: W/dalvikvm(7984): threadid=1: thread exiting with uncaught exception (group=0x40d8b9a8)
11-21 06:40:50.755: E/AndroidRuntime(7984): FATAL EXCEPTION: main
11-21 06:40:50.755: E/AndroidRuntime(7984): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemap/com.example.googlemap.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.access$600(ActivityThread.java:162)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.os.Handler.dispatchMessage(Handler.java:107)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.os.Looper.loop(Looper.java:194)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.main(ActivityThread.java:5371)
11-21 06:40:50.755: E/AndroidRuntime(7984): at java.lang.reflect.Method.invokeNative(Native Method)
11-21 06:40:50.755: E/AndroidRuntime(7984): at java.lang.reflect.Method.invoke(Method.java:525)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
11-21 06:40:50.755: E/AndroidRuntime(7984): at dalvik.system.NativeStart.main(Native Method)
11-21 06:40:50.755: E/AndroidRuntime(7984): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:281)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.Activity.setContentView(Activity.java:1881)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.example.googlemap.MainActivity.onCreate(MainActivity.java:16)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.Activity.performCreate(Activity.java:5122)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
11-21 06:40:50.755: E/AndroidRuntime(7984): ... 11 more
11-21 06:40:50.755: E/AndroidRuntime(7984): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 6171000 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.common.GooglePlayServicesUtil.E(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.maps.internal.u.T(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.maps.internal.u.S(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.maps.MapFragment$b.mA(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.app.Activity.onCreateView(Activity.java:4734)
11-21 06:40:50.755: E/AndroidRuntime(7984): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-21 06:40:50.755: E/AndroidRuntime(7984): ... 21 more
11-21 06:40:53.425: I/Process(7984): Sending signal. PID: 7984 SIG: 9
MainActivity.java
package com.example.googlemap;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
activity_xml文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
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"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
的Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.example.googlemap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" >
</permission>
<uses-permission android:name="com.example.googlemap.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<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-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<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="com.example.googlemap.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="AIfdsfsql6casdfsdfsdf9XTwcWe-sdfEAsdfGg" />
</application>
</manifest>