2013-11-22 14 views
0

我創建顯示基於谷歌地圖API的地圖,這應該是與Android 2.3 API級別兼容Android應用程序10的Android(Eclipse中)無法找到谷歌,播放services_lib.apk嘗試多種解決方案

我已經嘗試了所有的解決方案,我會遇到諸如:

  1. 進口現有的代碼到我的項目(檢查複製到工作區及其目錄的Google Play服務-LIB)
  2. 加入了正確元並在我的XML這樣(見下文)
  3. 我試圖設置幾個不同的設置模擬器

Android應用程序運行良好,但是當此頁面顯示是退出。

的Manifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="dcs.aber.ac.uk.cs211.group02" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="10" 
     android:targetSdkVersion="22" /> 

    <permission 
     android:name="dcs.aber.ac.uk.cs211.group02.permission.MAPS_RECEIVE" 
     android:protectionLevel="signature" /> 


    <!-- Accessing camera hardware --> 
    <!-- putting android.hardware.camera prevents non-camera devices using this app --> 
    <uses-feature android:name="android.hardware.camera" /> 
    <uses-feature 
     android:glEsVersion="0x00020000" 
     android:required="true" /> 
    <uses-permission android:name="dcs.aber.ac.uk.cs211.group02.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="dcs.aber.ac.uk.cs211.group02.providers.gsf.permission.READ_GSERVICES" /> 
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:logo="@drawable/ic_launcher" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="dcs.aber.ac.uk.cs211.group02.StartScreen" 
      android:label="@string/app_name" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity 
      android:name="dcs.aber.ac.uk.cs211.group02.CreateWalkActivity" 
      android:label="@string/title_activity_create_walk" > 
     </activity> 
     <activity 
      android:name="dcs.aber.ac.uk.cs211.group02.HelpScreen" 
      android:label="@string/title_activity_help_screen" > 
     </activity> 
     <activity 
      android:name="dcs.aber.ac.uk.cs211.group02.WalkRecording" 
      android:label="@string/title_activity_walk_recording" > 
     </activity> 
    </application> 

    <meta-data android:name="dcs.aber.ac.uk.cs211.group02.API_KEY" 
     android:value="AIzaSyBKYpKfU4zn-3IBkskKsLbwRsQ1-IqFldk" 
     /> 

    <meta-data android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version" /> 

</manifest> 

的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" 
    android:background="@color/black" 
    tools:context=".WalkRecording" > 

    <fragment 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:map="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/mapView" 
     android:name="com.google.android.gms.maps.SupportMapFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</RelativeLayout> 

爲地圖類

import com.google.android.gms.maps.GoogleMap; 
import com.google.android.gms.maps.SupportMapFragment; 

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

public class WalkRecording extends FragmentActivity { 

    private GoogleMap map; 

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

     map=((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapView)).getMap(); 

     map.setMapType(GoogleMap.MAP_TYPE_NORMAL); 
    } 

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

} 

蝕跟蹤java代碼:

[2013-11-22 23:03:07 - WalkingTours] ------------------------------ 
[2013-11-22 23:03:07 - WalkingTours] Android Launch! 
[2013-11-22 23:03:07 - WalkingTours] adb is running normally. 
[2013-11-22 23:03:07 - WalkingTours] Performing dcs.aber.ac.uk.cs211.group02.StartScreen activity launch 
[2013-11-22 23:03:07 - WalkingTours] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'mapTestAPI16' 
[2013-11-22 23:03:07 - WalkingTours] Uploading WalkingTours.apk onto device 'emulator-5554' 
[2013-11-22 23:03:07 - WalkingTours] Installing WalkingTours.apk... 
[2013-11-22 23:03:12 - WalkingTours] Success! 
[2013-11-22 23:03:12 - google-play-services_lib] Could not find google-play-services_lib.apk! 
[2013-11-22 23:03:12 - WalkingTours] Starting activity dcs.aber.ac.uk.cs211.group02.StartScreen on device emulator-5554 
[2013-11-22 23:03:14 - WalkingTours] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=dcs.aber.ac.uk.cs211.group02/.StartScreen } 
+0

順便說一下,API級別22不存在。 Android 4.4是19. – fasteque

回答

1

看到您的錯誤日誌,此link中提供了一個解決方案。不要導入google-play-services_lib APK,您應該將其作爲Android庫項目在您的項目中引用。

+0

我已經做到了,當我去項目>屬性> Android它顯示爲添加,但我仍然得到這個錯誤 –

+0

檢查這種方式。 http://stackoverflow.com/a/17160953/959260 – SASM

+0

我認爲只是添加jar似乎已經工作,但我有一個clas sno def發現錯誤的類拿着地圖,我必須首先理清 –

0

我有同樣的問題。 看項目中的項目:Properties-> Java Build Path刪除google-play-services_lib。 沒有必要包含在構建也作爲一個項目。