我已经将我的应用迁移到AndroidX以便使用app:drawableLeftCompat
。在迁移后,应用在某些屏幕上在运行时崩溃了,这些屏幕使用的是Android KitKat。而在Android 7上运行良好。ADB日志中没有堆栈跟踪。以下是部分日志:
E/dalvikvm: Could not find class 'android.view.textclassifier.TextClassificationManager', referenced from method androidx.appcompat.widget.AppCompatTextClassifierHelper.getTextClassifier
W/dalvikvm: VFY: unable to resolve const-class 759 (Landroid/view/textclassifier/TextClassificationManager;) in Landroidx/appcompat/widget/AppCompatTextClassifierHelper;
D/dalvikvm: VFY: replacing opcode 0x1c at 0x000a
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/textclassifier/TextClassifier;)
VFY: unable to find class referenced in signature (Landroid/view/textclassifier/TextClassifier;)
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/ViewStructure;)
I/dalvikvm: Could not find method android.widget.LinearLayout.dispatchProvideAutofillStructure, referenced from method com.google.android.material.textfield.TextInputLayout.dispatchProvideAutofillStructure
W/dalvikvm: VFY: unable to resolve virtual method 5194: Landroid/widget/LinearLayout;.dispatchProvideAutofillStructure (Landroid/view/ViewStructure;I)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x002e
W/dalvikvm: VFY: unable to resolve virtual method 4274: Landroid/view
/ViewConfiguration;.shouldShowMenuShortcutsWhenKeyboardPresent ()Z
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
D/EGL_emulation: eglMakeCurrent: 0xb7961980: ver 2 0
E/EGL_emulation: tid 3996: eglSurfaceAttrib(1199): error 0x3009 (EGL_BAD_MATCH)
W/HardwareRenderer: Backbuffer cannot be preserved
D/dalvikvm: Trying to load lib /data/app-lib/ru.septagon.android.cashregister-2/librsjni_androidx.so 0xa4ffabd0
Added shared lib /data/app-lib/ru.septagon.android.cashregister-2/librsjni_androidx.so 0xa4ffabd0
A/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 3996 (id.cashregister)
Application terminated.
从这个日志中我无法理解崩溃的原因。有什么想法吗?
这是应用程序模块的build.gradle文件。
apply plugin: 'com.android.application'
apply plugin: 'io.sentry.android.gradle'
def versionMajor = 1
def versionMinor = 3
def versionPatch = 0
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
android {
if (project.hasProperty('debBuild')) {
splits.abi.enabled = false
splits.density.enable = false
}
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
compileOptions.encoding = 'UTF-8'
lintOptions {
checkReleaseBuilds false
abortOnError false
disable 'MissingTranslation'
}
dataBinding {
enabled = true
}
dexOptions {
preDexLibraries true
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
splits {
abi {
enable true
reset()
universalApk true
}
}
defaultConfig {
applicationId "ru.septagon.android.cashregister"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName generateVersionName("${versionMajor}.${versionMinor}.${versionPatch}")
setProperty("archivesBaseName", "cashregister-$versionName")
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'int', 'SYNC_PERIOD_SEC', '360'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField 'int', 'SYNC_PERIOD_SEC', '60'
}
}
packagingOptions {
exclude 'lib/mips/libRSSupport.so'
exclude 'lib/mips/librsjni.so'
}
}
private String generateVersionName(String version) {
String versionName = version
if (project.hasProperty("buildVersion")) {
versionName += "." + project.getProperties().get("buildVersion").toString()
}
return versionName;
}
dependencies {
implementation project(':log')
implementation project(':esptouch')
implementation project(':pinpad')
implementation(name: 'android_util_fr_drv_ng-release', ext: 'aar')
// Google support
implementation "androidx.core:core:$rootProject.supportVersion"
implementation "androidx.legacy:legacy-support-core-ui:$rootProject.supportVersion"
implementation "androidx.legacy:legacy-support-v13:1.0.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.1.0-alpha02"
implementation "androidx.cardview:cardview:$rootProject.supportVersion"
implementation "androidx.recyclerview:recyclerview:$rootProject.supportVersion"
implementation "com.google.android.material:material:$rootProject.supportVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.annimon:stream:1.2.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.github.mmin18:realtimeblurview:1.1.2'
implementation 'com.ms-square:etsyblur:0.2.1'
// Google common
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
// google arch
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archVersion"
implementation "androidx.lifecycle:lifecycle-runtime:$rootProject.archVersion"
// Rx
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar'
// DI
implementation "com.google.dagger:dagger:$rootProject.daggerVersion"
implementation "com.google.dagger:dagger-android:$rootProject.daggerVersion"
implementation "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.daggerVersion"
// recycler view
implementation 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter:2.3.0-beta1'
implementation 'me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview:2.3.0-beta1'
// Network
implementation "com.squareup.okhttp3:okhttp:$rootProject.okhttpVersion"
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion"
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
// DB
implementation 'com.j256.ormlite:ormlite-android:5.0'
annotationProcessor "org.projectlombok:lombok:1.16.12"
// Glide
implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion"
annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glideVersion"
implementation 'jp.wasabeef:glide-transformations:3.0.1'
implementation 'joda-time:joda-time:2.10'
implementation 'me.jessyan:autosize:0.9.5'
implementation 'jp.wasabeef:recyclerview-animators:2.3.0'
implementation 'io.sentry:sentry-android:1.7.10'
implementation 'com.github.Kyash:rx-keyboard-detector:0.1.2'
// Test
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
}
这是主build.gradle文件。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'io.sentry:sentry-android-gradle-plugin:1.7.10'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'http://srv-recs-dev01:8081/nexus/content/repositories/releases/' }
maven { url 'http://srv-recs-dev01:8081/nexus/content/repositories/snapshots/' }
mavenLocal()
flatDir {
dirs 'libs'
dirs project(':pinpad').file('libs')
}
}
// buildScan { licenseAgreementUrl = 'https://gradle.com/terms-of-service'; licenseAgree = 'yes' }
}
task printVersion{
doLast {
print rootProject.childProjects.get("app").android.defaultConfig.versionName
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
compileSdkVersion = 28
buildToolsVersion = '28.0.3'
minSdkVersion = 19
targetSdkVersion = 26
supportVersion = '1.0.0-beta01'
servicesVersion = '11.8.0'
androidAnnotationVersion = '4.3.1'
archVersion = '2.0.0-beta01'
daggerVersion = '2.16'
okhttpVersion = '3.10.0'
retrofitVersion = '2.4.0'
glideVersion = '4.7.1'
crashlyticsVersion = '2.6.8'
commonsVersion = "1.3.0.3"
}