本文介绍了Android 10 崩溃(布局/abc_screen_simple 行 #17 中的 InflateException)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序从 Android 4.3 到 Android 9 Pie 都运行良好,但我的应用程序在 Android 10 (Q API 29) 上无法运行并崩溃.这是我的 logcat - 为什么会这样?

java.lang.RuntimeException:无法启动活动组件信息{ir.mahdi.circulars/ir.mahdi.circulars.MainActivity}:android.view.InflateException:二进制 

这是我的 mainActivity.

更新

应用插件:'com.android.application'安卓 {compileSdkVersion 29默认配置{minSdk 版本 16目标SDK版本29multiDexEnabled truetestInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"}构建类型{释放 {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}} }依赖{实现文件树(目录:'libs',包括:['*.jar'])实现 'androidx.appcompat:appcompat:1.0.0'实现 'com.google.android.material:material:1.0.0'实现 'androidx.constraintlayout:constraintlayout:1.1.3'testImplementation 'junit:junit:4.12'androidTestImplementation 'androidx.test:runner:1.2.0'androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' }
解决方案

更新 Calligraphy 到最新版本来解决这个问题:链接:https://github.com/InflationX/Calligraphy/issues/35>

更具体地说,Calligraphy ViewPump都需要更新:

实现'io.github.inflationx:calligraphy3:3.1.1'实现 'io.github.inflationx:viewpump:2.0.3'

从 Calligraphy 2 迁移到 3 需要一些代码更改;请参阅 Calligraphy 3 README 中的示例.

My application works fine from Android 4.3 until Android 9 Pie, but my application doesn't work on Android 10 (Q API 29) and crashes. This is my logcat - why this is happening?

java.lang.RuntimeException: Unable to start activity
     ComponentInfo{ir.mahdi.circulars/ir.mahdi.circulars.MainActivity}:
     android.view.InflateException: Binary 

and this is my mainActivity.

<?

update

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 29
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    } }

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' }
解决方案

Update Calligraphy to newest version to solve this problem:Link: https://github.com/InflationX/Calligraphy/issues/35

More specifically, both Calligraphy and ViewPump need to be updated:

implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'

Migrating from Calligraphy 2 to 3 requires some code changes; see examples in Calligraphy 3 README.

这篇关于Android 10 崩溃(布局/abc_screen_simple 行 #17 中的 InflateException)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 04:00