简体   繁体   中英

app compact v7 is not work on androidx so how to make this project in new library

===== Error ======

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.milesstudio.photoeditor, PID: 19734
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.milesstudio.photoeditor/com.milesstudio.photoeditor.Collage_Activity}: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class android.support.design.widget.AppBarLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
        at android.os.Handler.dispatchMessage(Handler.java:112)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
     Caused by: android.view.InflateException: Binary XML file line #76: Binary XML file line #76: Error inflating class android.support.design.widget.AppBarLayout
     Caused by: android.view.InflateException: Binary XML file line #76: Error inflating class android.support.design.widget.AppBarLayout
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.widget.AppBarLayout" on path: DexPathList[[zip file "/data/app/com.milesstudio.photoeditor-u_XgTUf7zqGb5Ukgt5P1JQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.milesstudio.photoeditor-u_XgTUf7zqGb5Ukgt5P1JQ==/lib/arm64, /data/app/com.milesstudio.photoeditor-u_XgTUf7zqGb5Ukgt5P1JQ==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.view.LayoutInflater.createView(LayoutInflater.java:613)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:801)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:874)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:835)
        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 com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:498)
        at com.android.internal.policy.HwPhoneWindow.setContentView(HwPhoneWindow.java:342)
        at android.app.Activity.setContentView(Activity.java:2941)
        at com.milesstudio.photoeditor.Collage_Activity.onCreate(Collage_Activity.java:1584)
        at android.app.Activity.performCreate(Activity.java:7458)
        at android.app.Activity.performCreate(Activity.java:7448)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1286)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3409)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
        at android.os.Handler.dispatchMessage(Handler.java:112)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/Process: Sending signal. PID: 19734 SIG: 9
Process 19734 terminated.

You need to use compatible AndroidX library.

For android.support.design.widget.AppBarLayout use material dependency with:

implementation 'com.google.android.material:material:1.0.0'

then change the view to:

com.google.android.material.appbar.AppBarLayout

See: https://developer.android.com/jetpack/androidx/migrate https://developer.android.com/jetpack/androidx/migrate/artifact-mappings .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM