我一直在谷歌Map上工作,但我得到了
不幸的是,APP被停止了。
我获得了所有权限和Google Play服务。这个错误正在我的LogCat中显示,我已经在下面显示了。
06-11 16:05:48.050: E/AndroidRuntime(851): FATAL EXCEPTION: main
06-11 16:05:48.050: E/AndroidRuntime(851): Process: com.example.onroad, PID: 851
06-11 16:05:48.050: E/AndroidRuntime(851): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.onroad/com.example.onroad.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.ActivityThread.access$800(ActivityThread.java:138)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.os.Handler.dispatchMessage(Handler.java:102)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.os.Looper.loop(Looper.java:136)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.ActivityThread.main(ActivityThread.java:5026)
06-11 16:05:48.050: E/AndroidRuntime(851): at java.lang.reflect.Method.invokeNative(Native Method)
06-11 16:05:48.050: E/AndroidRuntime(851): at java.lang.reflect.Method.invoke(Method.java:515)
06-11 16:05:48.050: E/AndroidRuntime(851): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
06-11 16:05:48.050: E/AndroidRuntime(851): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
06-11 16:05:48.050: E/AndroidRuntime(851): at dalvik.system.NativeStart.main(Native Method)
06-11 16:05:48.050: E/AndroidRuntime(851): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
06-11 16:05:48.050: E/AndroidRuntime(851): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
06-11 16:05:48.050: E/AndroidRuntime(851): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Activity.setContentView(Activity.java:1930)
06-11 16:05:48.050: E/AndroidRuntime(851): at com.example.onroad.MainActivity.onCreate(MainActivity.java:19)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Activity.performCreate(Activity.java:5242)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
06-11 16:05:48.050: E/AndroidRuntime(851): ... 11 more
06-11 16:05:48.050: E/AndroidRuntime(851): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Fragment.instantiate(Fragment.java:597)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Fragment.instantiate(Fragment.java:561)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Activity.onCreateView(Activity.java:4788)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
06-11 16:05:48.050: E/AndroidRuntime(851): ... 21 more
06-11 16:05:48.050: E/AndroidRuntime(851): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: DexPathList[[zip file "/data/app/com.example.onroad-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.onroad-2, /system/lib]]
06-11 16:05:48.050: E/AndroidRuntime(851): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-11 16:05:48.050: E/AndroidRuntime(851): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
06-11 16:05:48.050: E/AndroidRuntime(851): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
06-11 16:05:48.050: E/AndroidRuntime(851): at android.app.Fragment.instantiate(Fragment.java:583)
06-11 16:05:48.050: E/AndroidRuntime(851): ... 24 more
字符串
1条答案
按热度按时间sqyvllje1#
检查你是否真的在Google Developers控制台上创建了你的应用程序项目?..从这里了解Google Developers Console
同时检查你的manifest文件,你正确地添加了所有的权限和mata数据。
错误还显示您没有将“Google Play服务”添加到您的项目中。请从SDK插件中下载它们并将其添加到项目的依赖项中