Mon application fonctionne correctement de Android 4.3 à Android 9 Pie, mais mon application ne fonctionne pas sur Android 10 ( Q API 29) et plante. Ceci est mon logcat - pourquoi cela se produit-il?
Java.lang.RuntimeException: Unable to start activity
ComponentInfo{ir.mahdi.circulars/ir.mahdi.circulars.MainActivity}:
Android.view.InflateException: Binary XML file line #17
in ir.mahdi.circulars:layout/abc_screen_simple: Binary XML file line #17
in ir.mahdi.circulars:layout/abc_screen_simple:
Error inflating class androidx.appcompat.widget.FitWindowsLinearLayout
et voici mon mainActivity.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:app="http://schemas.Android.com/apk/res-auto"
xmlns:tools="http://schemas.Android.com/tools"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:background="@color/white"
Android:layoutDirection="ltr"
tools:context=".MainActivity">
</androidx.coordinatorlayout.widget.CoordinatorLayout>
mettre à jour
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' }
Migrez de chrisjenx/Calligraphy vers InflationX/Calligraphy et mettez à jour Calligraphy
vers la dernière version
Please foloow this below steps.
1> First of all check build.gradle(:app) file
2> If you are using this below library:
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
3> Update this " implementation 'uk.co.chrisjenx:calligraphy:2.3.0' " library with this below library.
implementation 'io.github.inflationx:viewpump:2.0.3'
implementation 'io.github.inflationx:calligraphy3:3.1.1'
4> In project where You use this below code :
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
5> Update it with this below code:
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
Vous pouvez changer la version buildTools et la version sdk de 29 à 28
targetSdk = 28
compileSdk = 28
buildTools = '28.0.3'
Face à ce problème, il suffit de mettre à jour la calligraphie et le viewpump de votre gradle d'application vers la dernière version. Actuellement, la version actuelle est: implémentation 'io.github.inflationx: calligraphie3: 3.1.1' implémentation 'io.github.inflationx: viewpump: 2.0.3'