gpt4 book ai didi

android - App SDK 从 27.0.2 迁移到 27.1.0 失败(崩溃)

转载 作者:搜寻专家 更新时间:2023-11-01 09:28:35 26 4
gpt4 key购买 nike

我今天早上刚刚用新的 SDK 升级了我的 Gradle:

    // https://developer.android.com/studio/build/multidex.html
implementation 'com.android.support:multidex:1.0.3'

// https://developer.android.com/topic/libraries/support-library/revisions.html
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support:gridlayout-v7:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:exifinterface:27.1.0'

不幸的是,现在我的第一个 Activity 启动时发生了崩溃。此 Activity 没有布局。在此 SDK 升级之前,它运行良好...

  03-06 10:20:33.117 18722-18722/com.xxx.dev E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.azeoo.dev, PID: 18722
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.dev/com.xxx.ui.intro.WelcomeActivity}: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout
Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class LinearLayout
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
at android.content.res.TypedArray.getString(TypedArray.java:202)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1006)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1776)
at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2613)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2686)
at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2049)
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
at android.support.v7.app.AppCompatDelegateImplV9.initWindowDecorActionBar(AppCompatDelegateImplV9.java:175)
at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:145)
at android.support.v7.app.AppCompatActivity.getSupportActionBar(AppCompatActivity.java:109)
at com.xxx.ui.BaseActivity.onCreate(BaseActivity.java:759)
at com.xxx.ui.intro.WelcomeActivity.onCreate(WelcomeActivity.java:45)
at android.app.Activity.performCreate(Activity.java:6672)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

非常感谢大家的支持!

最佳答案

删除你的

buildToolsVersion 来自您的应用级 gradle 文件,以防您想要升级到 27.1.0。所以如果你把buildToolsVersion 27.0.2

buildToolsVersion 27.0.3

可能存在冲突,因为 buildToolsVersion 27.1.0 尚未发布。

So, removing the buildToolsVersion x.x.x might do the trick !!

编辑 1

即使删除 buildToolsVersion 可能有效,我还是建议坚持使用 27.0.2,因为 27.1.0 会导致一些意外崩溃,并且有一些错误。其中之一是:-

java.lang.ClassCastException: android.support.v7.widget.ActivityChooserView$InnerLayout cannot be cast to android.support.v7.widget.LinearLayoutCompat

甚至谷歌也宣布了它(在 GOOGLE ISSUE TRACKER 中)。所以,大家最好坚持使用 27.0.2,直到发布固定且稳定的版本。

关于android - App SDK 从 27.0.2 迁移到 27.1.0 失败(崩溃),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49127486/

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