Android地图应用V2崩溃不断 [英] Android Maps V2 App constantly crashes
问题描述
我有我的应用程序,采用的是Android API V2的问题在于它不会启动它只是口口声声说不幸的是,APP_NAME已停止工作。我按照指南中的每一步由谷歌和发布我也曾在这里抬头类似的问题在计算器,并试图解决存在,但没有似乎不幸的是工作。
一我似乎有最大的问题是这样的。
产生的原因:抛出java.lang.ClassNotFoundException:找不到类com.google.android.gms.maps.MapFragment
尽管我已经加入了谷歌Play服务库,并把它添加到应用程序项目。那么,问题出在哪里?
进口android.support.v4.app.FragmentActivity;
进口com.google.android.gms.maps.SupportMapFragment;
进口com.google.android.gms.maps.GoogleMap;
进口android.os.Bundle;
进口android.view.Menu;公共类MainActivity扩展FragmentActivity {SupportMapFragment MMAP;
GoogleMap的GoogleMap的;@覆盖
保护无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.activity_main); MMAP =(SupportMapFragment)getSupportFragmentManager()
.findFragmentById(R.id.map); GoogleMap的= mMap.getMap();}@覆盖
公共布尔onCreateOptionsMenu(菜单菜单){
//充气菜单;如果是present这增加了项目操作栏。
。getMenuInflater()膨胀(R.menu.activity_main,菜单);
返回true;
}}
您测试您的模拟器或device..Because应用谷歌的MapV2需要与谷歌打的apk安装一个Android设备。
I have a problem with my app that uses the android api v2 in that it won't start it only keeps saying that "Unfortunately, app_name has stopped working.", I have followed every step in the guide released by google and I have also looked up similar problems here in StackOverflow and tried there solution but none seems to work unfortunately.
One of the biggest problem I seem to have is this
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment"
even though I have added the Google Play services library and have added it to the app project. so where does the problem lie?
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.GoogleMap;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
SupportMapFragment mMap;
GoogleMap googleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMap = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
googleMap = mMap.getMap();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Are you testing your application on Emulator or device..Because the google MapV2 requires a Android device with Google play apk installed in it.
这篇关于Android地图应用V2崩溃不断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!