anthony
anthony

Reputation: 7733

App SDK migration from 27.0.2 to 27.1.0 failed (crash)

I've just upgraded my Gradle this morning with the new SDK:

    // 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'

Unfortunately now there is a crash during my first Activity starts. This Activity has not layout. It worked perfectly before this SDK upgrade...

  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)

Thank you very much guys for your support!

Upvotes: 2

Views: 1275

Answers (1)

Santanu Sur
Santanu Sur

Reputation: 11477

Remove your

buildToolsVersion from your app-level gradle file in case you want to upgrade to 27.1.0. So if you put buildToolsVersion 27.0.2

or buildToolsVersion 27.0.3

there might be a conflict cause buildToolsVersion 27.1.0 is not released yet.

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

Edit 1

Even though removing buildToolsVersion might work, i would recommend to stick to 27.0.2 because 27.1.0 is causing some undesired crashes and has a few bugs. One of which is :-

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

Even google has announced it ( in GOOGLE ISSUE TRACKER ). So , guys better stick to 27.0.2 untill the fixed and stable version is released.

Upvotes: 2

Related Questions