我是android的初学者,我目前正在通过udacity课程在线学习android studio,这是创建一个阳光应用程序。现在,我在第二课中遇到麻烦,它将阳光连接到云端,我遵循所有步骤但仍然遇到问题:不幸的是,阳光已经停止了。我尝试使用DDMS工具进行调试,但我仍然无法解决它。
下面的是log cat中的消息:
01-18 16:12:50.667 16173-16173/? D/dalvikvm: Late-enabling CheckJNI
01-18 16:12:50.697 16173-16184/? V/ActivityThread: SCHEDULE 138 SET_CORE_SETTINGS: 0 / Bundle[mParcelledData.dataSize=60]
01-18 16:12:50.697 16173-16184/? V/ActivityThread: SCHEDULE 110 BIND_APPLICATION: 0 / AppBindData{appInfo=ApplicationInfo{40e687a8 com.cheeleong1993.sunshine.app}}
01-18 16:12:50.707 16173-16185/? V/ActivityThread: SCHEDULE 100 LAUNCH_ACTIVITY: 0 / ActivityRecord{40e6ae18 token=android.os.BinderProxy@40e6a558 {com.cheeleong1993.sunshine.app/com.cheeleong1993.sunshine.app.MainActivity}}
01-18 16:12:50.717 16173-16173/com.cheeleong1993.sunshine.app V/ActivityThread: >>> handling: SET_CORE_SETTINGS
01-18 16:12:50.717 16173-16173/com.cheeleong1993.sunshine.app V/ActivityThread: <<< done: SET_CORE_SETTINGS
01-18 16:12:50.717 16173-16173/com.cheeleong1993.sunshine.app V/ActivityThread: >>> handling: BIND_APPLICATION
01-18 16:12:50.727 16173-16173/com.cheeleong1993.sunshine.app V/ActivityThread: <<< done: BIND_APPLICATION
01-18 16:12:50.727 16173-16173/com.cheeleong1993.sunshine.app V/ActivityThread: >>> handling: LAUNCH_ACTIVITY
01-18 16:12:50.737 16173-16173/com.cheeleong1993.sunshine.app W/SystemTheme/Resources: createSystemThemeIfNeeded
01-18 16:12:50.737 16173-16173/com.cheeleong1993.sunshine.app I/SystemThemeResource: SystemThemeResource: set to default lenovo theme
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to resolve interface method 17963: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to resolve interface method 17967: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
01-18 16:12:50.747 16173-16173/com.cheeleong1993.sunshine.app D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
01-18 16:12:50.777 16173-16173/com.cheeleong1993.sunshine.app I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
01-18 16:12:50.777 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to resolve virtual method 421: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
01-18 16:12:50.777 16173-16173/com.cheeleong1993.sunshine.app D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-18 16:12:50.787 16173-16173/com.cheeleong1993.sunshine.app I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
01-18 16:12:50.787 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to resolve virtual method 443: Landroid/content/res/TypedArray;.getType (I)I
01-18 16:12:50.787 16173-16173/com.cheeleong1993.sunshine.app D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app I/dalvikvm: Could not find method android.widget.LinearLayout$LayoutParams.<init>, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.<init>
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to resolve direct method 18480: Landroid/widget/LinearLayout$LayoutParams;.<init> (Landroid/widget/LinearLayout$LayoutParams;)V
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app D/dalvikvm: VFY: replacing opcode 0x70 at 0x0000
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app I/dalvikvm: Could not find method android.widget.LinearLayout$LayoutParams.<init>, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.<init>
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: VFY: unable to resolve direct method 18480: Landroid/widget/LinearLayout$LayoutParams;.<init> (Landroid/widget/LinearLayout$LayoutParams;)V
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app D/dalvikvm: VFY: replacing opcode 0x70 at 0x0000
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app D/AndroidRuntime: Shutting down VM
01-18 16:12:50.797 16173-16173/com.cheeleong1993.sunshine.app W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40ba6ac8)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: FATAL EXCEPTION: main
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cheeleong1993.sunshine.app/com.cheeleong1993.sunshine.app.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:148)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5138)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class fragment
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:807)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.cheeleong1993.sunshine.app.MainActivity.onCreate(MainActivity.java:34)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5109)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:148)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5138)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.cheeleong1993.sunshine.app.MainActivityFragment: make sure class name exists, is public, and has an empty constructor that is public
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Fragment.instantiate(Fragment.java:592)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Fragment.instantiate(Fragment.java:560)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Activity.onCreateView(Activity.java:4714)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:34)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:807)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.cheeleong1993.sunshine.app.MainActivity.onCreate(MainActivity.java:34)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5109)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:148)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5138)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.cheeleong1993.sunshine.app.MainActivityFragment" on path: /data/app/com.cheeleong1993.sunshine.app-1.apk
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Fragment.instantiate(Fragment.java:582)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Fragment.instantiate(Fragment.java:560)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Activity.onCreateView(Activity.java:4714)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:34)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:807)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.cheeleong1993.sunshine.app.MainActivity.onCreate(MainActivity.java:34)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5109)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2247)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.access$600(ActivityThread.java:148)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5138)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-18 16:12:50.807 16173-16173/com.cheeleong1993.sunshine.app E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
01-18 16:12:50.907 16173-16184/com.cheeleong1993.sunshine.app V/ActivityThread: SCHEDULE 102 PAUSE_ACTIVITY_FINISHING: 0 / android.os.BinderProxy@40e6a558
01-18 16:12:51.577 16173-16185/com.cheeleong1993.sunshine.app V/ActivityThread: SCHEDULE 140 TRIM_MEMORY: 20 / null
01-18 16:12:51.577 16173-16185/com.cheeleong1993.sunshine.app V/ActivityThread: SCHEDULE 109 DESTROY_ACTIVITY: 1 / android.os.BinderProxy@40e6a558
任何人都可以帮助我吗?感谢
答案 0 :(得分:0)
将此视为评论,由于声誉较低,我无法添加评论,因此将其作为答案发布。
从上面粘贴的logcat一眼就看出它找不到"com.cheeleong1993.sunshine.app.MainActivityFragment"
类,所以确保MainActivity类有以下代码片段
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new MainActivityFragment())
.commit();
}
}
而activity_main.xml下面是代码片段
FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" tools:ignore="MergeRootFrame" />
然后它应该解决你的错误。如果您仍然面临错误,那么请分享您在主要活动类中膨胀片段的xml和类文件。
希望这会有所帮助 欢呼声。