gpt4 book ai didi

android - CollapsingToolbarLayout 不工作应用程序崩溃

转载 作者:行者123 更新时间:2023-11-29 19:29:17 26 4
gpt4 key购买 nike

如果我将依赖项从 23.1.1 更新到 23.2.0,CollapsingToolbarLayout 将无法正常工作。应用崩溃并抛出错误。

java.lang.RuntimeException:android.view.InflateException: Binary XML file line #77: Binary XML file line #77: Error inflating class android.support.design.widget.CollapsingToolbarLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7331)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: android.view.InflateException: Binary XML file line #77: Binary XML file line #77: Error inflating class android.support.design.widget.CollapsingToolbarLayout
at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
Caused by: java.lang.NoSuchMethodError: No static method setLayoutDirection(Landroid/graphics/drawable/Drawable;I)V in class Landroid/support/v4/graphics/drawable/DrawableCompat; or its super classes (declaration of 'android.support.v4.graphics.drawable.DrawableCompat' appears in /data/app/in.passionconnect.application-1/base.apk)

依赖看起来像这样

compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
compile 'com.android.support:support-v4:23.2.0'

和我的 compileSdkVersion 23 buildToolsVersion "23.0.2"

最佳答案

你可以试试稳定的 24.2.0'

第一步

compileSdkVersion 24
buildToolsVersion "24.0.2"

第 2 步

 targetSdkVersion 24

然后

第 3 步

 compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'

最后 Clean-Rebuild-Gradle 并运行。

关于android - CollapsingToolbarLayout 不工作应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40481061/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com