我正在制作一个使用谷歌地图的应用程序,我的主要 xml 代码 fragment 如下:
<com.google.android.maps.MapView
android:id="@+id/mapview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:apiKey="0lr6nShkIg955xnYpmUOgPpsSuEJctwQIUXExhw"
android:clickable="true"
android:enabled="true" >
</com.google.android.maps.MapView>
我的java代码是:
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MapList extends MapActivity {
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
System.out.println("hello1");
super.onCreate(savedInstanceState);
System.out.println("hello");
setContentView(R.layout.main);
}
android list 是:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-library android:name="com.google.android.maps" />
但是在编译时它给了我异常:
java.lang.RuntimeException:无法实例化 Activity ComponentInfo {com.trigma.map/com.trigma.map.MapList}:java.lang.ClassNotFoundException:加载程序 dalvik 中的 com.trigma.map.MapList。 system.PathClassLoader[/data/app/com.trigma.map-1.apk]
.
谁能帮我解决这个问题?
最佳答案
正如你所说你已经写了这个但是你定义了这一行
<uses-library android:name="com.google.android.maps" />
在 <application> here </application>
之间标记?
昨天我也犯了同样的错误,所以只是要求检查。
关于机器人:实现谷歌地图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8046782/