App wont launch after following tutorial on youtube

0 Jordan Pountley · September 16, 2015
Hi I was following Buckys 2nd tutorial on youtube and for some reason the app wont launch on the emulator it just replies with "Unfortunatley, Fragments has stopped." Fragments is the name of the app. I was wondering if anyone can shed any light on the situation as I am new to app dev

The following is all in red in the logcat:

09-16 13:10:21.394    7974-7974/com.jordomanoa.fragments E/AndroidRuntime? FATAL EXCEPTION: main
    Process: com.jordomanoa.fragments, PID: 7974
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jordomanoa.fragments/com.jordomanoa.fragments.MainActivity}: android.view.InflateException: Binary XML file line #17: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
            at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.jordomanoa.fragments.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>
            at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at com.jordomanoa.fragments.BottomPictureFragment.onCreateView(BottomPictureFragment.java:19)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1185)
            at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1287)
            at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2243)
            at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
            at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:278)
            at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
            at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:78)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:754)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.jordomanoa.fragments.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
            at android.view.LayoutInflater.createView(LayoutInflater.java:645)
            at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
            at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at com.jordomanoa.fragments.BottomPictureFragment.onCreateView(BottomPictureFragment.java:19)
            at android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:995)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1185)
            at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1287)
            at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2243)
            at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
            at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:278)
            at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
            at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:78)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:754)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
            at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:255)
            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
            at com.jordomanoa.fragments.MainActivity.onCreate(MainActivity.java:13)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.newInstance(Native Method)
            at android.view.LayoutInflater.createVie

Post a Reply

Replies

Oldest  Newest  Rating
0 Gary Whitney · September 16, 2015
It appears to me that the source of the problem is in your XML layout. The activity tries to start but chokes on inflating the xml.

TIP! When you see red in the logcat, go to the place where the red begins. There you will  find the source of  the problem. The rest of the red is mostly Android stepping in to  Android methods and the original problem propagates and continues to cause more errors.

Note: You say you are on the 2nd video but your code has the word fragment in it. Fragments tutorials start on Tutorial 23 at thenewboston.com. To me this means you are on #24 of the meme project. I could post my xml for you but I am not even sure what tutorial you are referencing. Besides it is always  better to "learn to fish than to be given a fish".
  • 1

Java / Android Development

106,975 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator