一个星期以来,我一直坚持这个问题,而没有继续前进。我只用空白地图来获取活动。
首先,我按照google maps developers site上的说明操作,但没有成功。然后我尝试从谷歌播放服务mapdemo复制一些代码,但仍然失败。 我尝试了我在这里找到的所有内容和其他网站,以便制作一个SupportMapFragment,但没有任何帮助。
google mapdemo本身在我的调试设备(samsung s6500)上运行良好。
感谢
logcat的:
07-21 22:12:33.819: W/dalvikvm(13123): VFY: unable to resolve instance field 27
07-21 22:12:34.019: W/dalvikvm(13123): Unable to resolve superclass of Lmaps/p/w; (718)
07-21 22:12:34.019: W/dalvikvm(13123): Link of class 'Lmaps/p/w;' failed
07-21 22:12:34.019: W/dalvikvm(13123): Unable to resolve superclass of Lmaps/aq/as; (5347)
07-21 22:12:34.019: W/dalvikvm(13123): Link of class 'Lmaps/aq/as;' failed
07-21 22:12:34.019: W/dalvikvm(13123): Unable to resolve superclass of Lmaps/ag/l; (4576)
07-21 22:12:34.019: W/dalvikvm(13123): Link of class 'Lmaps/ag/l;' failed
07-21 22:12:34.019: E/dalvikvm(13123): Could not find class 'maps.ag.l', referenced from method maps.ah.an.a
07-21 22:12:34.019: W/dalvikvm(13123): VFY: unable to resolve new-instance 4420 (Lmaps/ag/l;) in Lmaps/ah/an;
07-21 22:12:34.559: E/Adreno200-ES20(13123): **** 13302: glUseProgram(0)
07-21 22:12:34.759: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 0
07-21 22:12:34.759: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.769: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 1
07-21 22:12:34.769: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.779: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 0
07-21 22:12:34.779: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.799: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 1
07-21 22:12:34.799: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.819: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 0
07-21 22:12:34.819: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
07-21 22:12:34.839: E/Adreno200-EGLSUB(13123): Enter: GetBackBuffer(), surface: 0x2c7938, bufid: 1
07-21 22:12:34.839: E/Adreno200-EGLSUB(13123): Return: GetBackBuffer(), TRUE
.
.
.
....
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="iOphir.mapapp"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="iOphir.mapapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="iOphir.mapapp.permission.MAPS_RECEIVE"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<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"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIza-----------"/>
<activity
android:name="iOphir.mapapp.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>
<activity
android:name="iOphir.mapapp.MapActivity"
android:label="@string/title_activity_map" />
</application>
</manifest>
活动
package iOphir.mapapp;
import iOphir.mapapp.R;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapActivity extends FragmentActivity {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
setUpMapIfNeeded();
}
@Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}
private void setUpMap() {
mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}
布局:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
答案 0 :(得分:0)
发现问题。现在我感到愚蠢。
我的包是.mapapp,但是在SHA-1指纹之后我输入了.mappapp。
哦......我很高兴能够克服它,但因为接触它而成为一个混蛋。
感谢无论谁尝试过。