0

I just wanted to build a signed apk, then I got lots of errors which I realized most of them would be solved by migrating to android X, but I get this runtime error after migrating to androidX:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.hamed/com.test.hamed.cups}: android.view.InflateException: Binary XML file line #18: Binary XML file line #18: Error inflating class android.support.design.widget.AppBarLayout

where line #18 that is mentioned is:

 <android.support.design.widget.
     android:id="@+id/cupsAppBar"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:theme="@style/AppTheme.AppBarOverlay">

and in Java is this line in onCretae:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cups); // <= this line
        .
        .
        .

I have searched a lot and some suggest that adding the following line would solve the problem but it didn't:

    implementation 'com.android.support:design:28.0.0'

What is the problem and how can I fix this? Thanks

Hamed Salimian
  • 791
  • 2
  • 11
  • 28
  • 1
    android X will not use any support libraries, please remove support in gradle & update the package with android x, it will work – Hanuman Feb 19 '20 at 14:22

1 Answers1

1

The correct usage for AppBarLayout is now com.google.android.material.appbar.AppBarLayout

tyczj
  • 71,600
  • 54
  • 194
  • 296