java.lang.ClassCastException:androidx.appcompat.widget.ActionBarOverlayLayout无法转换为android.support.v7.widget.DecorContentParent

时间:2018-06-21 13:59:24

标签: android material-design android-version material-components-android

我为我的项目添加了编译'com.google.android.material:material:1.0.0-alpha1',以获取最近的支持ClassCastException的材料。我的目标和编译SDK版本是28。

所有带有getActionBar的活动都会引发此异常。带有操作栏的应用程序主题也会引发错误。 使用该主题进行活动。

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

我详细的崩溃日志

  

java.lang.RuntimeException:无法启动活动   ComponentInfo {..... / com.theartofdev.edmodo.cropper.CropImageActivity}:   java.lang.ClassCastException:   androidx.appcompat.widget.ActionBarOverlayLayout无法强制转换为   android.support.v7.widget.DecorContentParent                                                                             在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)                                                                             在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2906)                                                                             在android.app.ActivityThread.-wrap11(未知来源:0)                                                                             在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1605)                                                                             在android.os.Handler.dispatchMessage(Handler.java:105)                                                                             在android.os.Looper.loop(Looper.java:172)                                                                             在android.app.ActivityThread.main(ActivityThread.java:6637)                                                                             在java.lang.reflect.Method.invoke(本机方法)                                                                             在   com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)                                                                             在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)                                                                          造成原因:java.lang.ClassCastException:   androidx.appcompat.widget.ActionBarOverlayLayout无法强制转换为   android.support.v7.widget.DecorContentParent                                                                             在   android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:414)                                                                             在   android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)                                                                             在   android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)                                                                             在   android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)                                                                             在   com.theartofdev.edmodo.cropper.CropImageActivity.onCreate(CropImageActivity.java:63)                                                                             在android.app.Activity.performCreate(Activity.java:6975)                                                                             在   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)                                                                             在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2784)                                                                             在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2906)                                                                             在android.app.ActivityThread.-wrap11(未知来源:0)                                                                             在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1605)                                                                             在android.os.Handler.dispatchMessage(Handler.java:105)                                                                             在android.os.Looper.loop(Looper.java:172)                                                                             在android.app.ActivityThread.main(ActivityThread.java:6637)                                                                             在java.lang.reflect.Method.invoke(本机方法)                                                                             在   com.android.internal.os.Zygote $ MethodAndArgsCaller.run(Zygote.java:240)                                                                             在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

0 个答案:

没有答案