2012-03-10 115 views
7

我嘗試import com.google.android.maps.MapActivity但我的程序無法識別它。我也有<uses-library android:name="com.google.android.maps" /> 並在我的項目中設置apiKey。無法導入com.google.android.maps.MapActivity

任何人都可以解釋爲什麼我可以導入上述行嗎? 在此先感謝。

+0

看看這個如何創建模擬器和地圖的所有特徵http://codemagician.wordpress.com/2010/05/06/android-google-mapview-tutorial-done-right/ – 2012-03-10 11:55:34

回答

11

什麼Android版本給你使用?在您的項目設置中,確保您使用包含Google API的Project Build Target。通常他們是「Google API」的名稱。

我包含了項目設置的圖像。 Select the one which says "Google APIs". They should include the needed packages.

+0

是的,我已經使用Google API級別7. – detno29 2012-03-10 12:11:00

+0

嘗試使用不同的版本並清理項目。 – Norman 2012-03-10 12:14:10

+0

我發現了這個問題。問題是我沒有在這個項目中導入maps.jar文件...:D – detno29 2012-03-10 14:09:38

7

右鍵單擊您的項目並選擇屬性,然後從Google Inc. 2.2版或更高版本中選擇Android> Google API。請務必選擇任何Google API而不是Android 2.2或更高版本的API,因爲只有Google API具有android.maps庫。

+0

你是男人:D – joao2fast4u 2014-12-19 11:08:09