我有一个奇怪的错误。我正在开发一个实现 google map v2 的项目。一切正常,直到有一天我在日食中出错。不知何故,我无法清理项目。所以我删除了项目,然后从 svn 中检查了 agin。之后我尝试清洁它并且它有效。当我想运行该项目时,出现以下错误:
08-05 00:45:21.636: E/AndroidRuntime(16997): FATAL EXCEPTION: main
08-05 00:45:21.636: E/AndroidRuntime(16997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.travelbook/com.example.travelbook.MainActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2077)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2104)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.ActivityThread.access$600(ActivityThread.java:134)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.os.Handler.dispatchMessage(Handler.java:99)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.os.Looper.loop(Looper.java:137)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.ActivityThread.main(ActivityThread.java:4624)
08-05 00:45:21.636: E/AndroidRuntime(16997): at java.lang.reflect.Method.invokeNative(Native Method)
08-05 00:45:21.636: E/AndroidRuntime(16997): at java.lang.reflect.Method.invoke(Method.java:511)
08-05 00:45:21.636: E/AndroidRuntime(16997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
08-05 00:45:21.636: E/AndroidRuntime(16997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
08-05 00:45:21.636: E/AndroidRuntime(16997): at dalvik.system.NativeStart.main(Native Method)
08-05 00:45:21.636: E/AndroidRuntime(16997): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class fragment
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:699)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:741)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.view.LayoutInflater.inflate(LayoutInflater.java:491)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
08-05 00:45:21.636: E/AndroidRuntime(16997): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:252)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Activity.setContentView(Activity.java:1837)
08-05 00:45:21.636: E/AndroidRuntime(16997): at com.example.travelbook.MainActivity.onCreate(MainActivity.java:63)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Activity.performCreate(Activity.java:4479)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2041)
08-05 00:45:21.636: E/AndroidRuntime(16997): ... 11 more
08-05 00:45:21.636: E/AndroidRuntime(16997): 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
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Fragment.instantiate(Fragment.java:581)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Fragment.instantiate(Fragment.java:549)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Activity.onCreateView(Activity.java:4249)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
08-05 00:45:21.636: E/AndroidRuntime(16997): ... 21 more
08-05 00:45:21.636: E/AndroidRuntime(16997): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
08-05 00:45:21.636: E/AndroidRuntime(16997): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-05 00:45:21.636: E/AndroidRuntime(16997): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-05 00:45:21.636: E/AndroidRuntime(16997): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-05 00:45:21.636: E/AndroidRuntime(16997): at android.app.Fragment.instantiate(Fragment.java:571)
08-05 00:45:21.636: E/AndroidRuntime(16997): ... 24 more
这对我来说没有意义,因为我没有对我的代码进行任何更改,而且正如我所说的项目正在运行。有人知道为什么会这样吗?以及如何解决?我正在使用日食朱诺
谢谢