androidandroid-studioandroidxsigned-apk

runtime error after migrating to androidX


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


Solution

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