Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start activity ComponentInfo{com.example.android.pets/com.example.android.pets.CatalogActivity} #36

Closed
Amirhossein-Ab opened this issue Aug 29, 2019 · 5 comments

Comments

@Amirhossein-Ab
Copy link

AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.pets, PID: 6577
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.pets/com.example.android.pets.CatalogActivity}: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class android.support.design.widget.FloatingActionButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
Caused by: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class android.support.design.widget.FloatingActionButton
Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class android.support.design.widget.FloatingActionButton
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.FloatingActionButton" on path: DexPathList[[zip file "/data/app/com.example.android.pets-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.android.pets-1/lib/arm, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:616)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:545)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.example.android.pets.CatalogActivity.onCreate(CatalogActivity.java:37)
at android.app.Activity.performCreate(Activity.java:6955)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)

@tara-97
Copy link

tara-97 commented Jan 5, 2020

Change the <android.support.design.widget.FloatingActionButton ...>tag for floating action button to
<com.google.android.material.floatingactionbutton.FloatingActionButton ...>.Here is the code for xml layout for activity_catalog.xml.
`

<TextView
    android:id="@+id/text_view_pet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/activity_margin"/>

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_margin="@dimen/fab_margin"
    android:src="@drawable/ic_add_pet"
    android:layout_alignParentEnd="true" />

`

@Classy-Bear
Copy link

Thanks @tara-97, it works for me!

@rohitashav-aggarwal
Copy link

I had the same issue, it worked for me too. Thanks for the solution.

@Abu3726
Copy link

Abu3726 commented Aug 16, 2021

Thanks

@SudKul
Copy link
Contributor

SudKul commented Jun 15, 2022

We have upgraded to code to AndroidX in this commit.

We recommend you use the https://knowledge.udacity.com/ platform to discuss individual issues with our experienced mentors.

@SudKul SudKul closed this as completed Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants