运行 集成测试中途 LinearAlloc 溢出
Running into LinearAlloc overflows midway through integration tests
这是一个较大的 3-4 年 运行ning Android 项目,运行ning Gradle 5.4.1。集成测试使用 Mockito、espresso 和 dagger。
我有 运行 问题,我们正在向项目添加 Pendo 库,依赖项已作为标准添加到 Gradle。一切 运行 都很好,直到我们尝试 运行 集成测试(~2000),这些 运行 在 Spoon 的碎片中。
大约在集成测试进行到一半时,在每次随机测试中,由于 LinearAlloc 超出容量,我们 运行 进入本机崩溃并终止测试 运行。 运行 这些测试是孤立的,或者在他们的 类 本地测试中,它们毫无问题地通过了,并且已经稳定了很长时间。
我将整个应用程序恢复到已知的良好构建,仅添加了 Pendo 依赖项,这导致了同样的问题,但我不认为这是由于 Pendo,因为我通过返回测试已知良好的构建(此时再次测试以确保完整性)并添加一个随机的新依赖项,这导致了同样的问题。
据我所知,这可能与 Android 周围的方法限制有关。我应该提到我们正在使用 multidex 来分解应用程序。 Proguard 和 minify 也在使用中。
这里的部分问题是我真的不确定要看什么才能弄清楚是什么原因导致了这种溢出。按照测试 运行s 的日志,似乎没有什么不对劲,除了相当多的垃圾收集(我猜这意味着某处有泄漏)。我不确定这个问题是否归结为一些潜在的泄漏,以及新库是否正在将某些东西推到边缘,或者是否存在我不知道的 android 中的一些依赖限制,或者其他一些方式分解文件,这样我们就不会导致 LinearAlloc 填满。
通过阅读,我知道 LinearAlloc 的限制在 Android 5 左右提高了,我们在高于 (Android 10) 和低于此 (Android 4) 的设备上都遇到了问题) 并且自 2017 年以来我并没有看到太多关于此的讨论,所以我觉得我遗漏了一些明显的东西,或者项目中的某些东西配置错误,因为它是在那之前设置的。
任何帮助将不胜感激。我在下面转储了 gradle 文件的精简版
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
sourceSets {
main.java.srcDirs += "src/main/kotlin"
main.jniLibs.srcDirs = ["src/main/jni"]
androidTest.java.srcDirs += ["src/androidTest/kotlin", "src/testUtilities/kotlin"]
debug.java.srcDirs += "src/debug/kotlin"
test.java.srcDirs += ["src/test/kotlin", "src/testUtilities/kotlin"]
}
defaultConfig {
minSdkVersion 17
targetSdkVersion 25 // Required to be sdk 25
versionCode 94
versionName "3.4.0"
versionNameSuffix System.getenv("ANDROID_VERSION_NAME_SUFFIX") ?: ""
multiDexEnabled true
multiDexKeepProguard file("multidex-keep-rules.pro")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testBuildType "debug"
renderscriptTargetApi 17
renderscriptSupportModeEnabled false
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
exclude "META-INF/ASL2.0"
exclude "META-INF/LICENSE"
exclude "META-INF/NOTICE"
exclude "META-INF/NOTICE.txt"
exclude "META-INF/LICENSE.txt"
exclude "META-INF/MANIFEST.MF"
exclude "META-INF/main.kotlin_module"
exclude "META-INF/proguard/androidx-annotations.pro"
exclude "META-INF/atomicfu.kotlin_module"
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
testCoverageEnabled = false
applicationIdSuffix = '.dev'
versionNameSuffix "-debug"
manifestPlaceholders = [isDebug: true]
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
manifestPlaceholders = [isDebug: false]
}
}
dataBinding {
enabled = true
}
testOptions {
animationsDisabled = true
}
lintOptions {
checkDependencies = false
checkGeneratedSources = false
ignoreTestSources = true
disable "ExpiredTargetSdkVersion"
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
composer {
variants "debug"
shard true
withOrchestrator false
verboseOutput false
keepOutput true
if (project.hasProperty("composerClassTarget")) {
instrumentationArgument("class", project.getProperty("composerClassTarget"))
}
}
configurations {
ktlint
}
task ktlint(type: JavaExec) {
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
}
check.dependsOn ktlint
detekt {
input = files("$project.projectDir/src")
config = files("$project.projectDir/detekt.yml")
filters = ".*/testUtilities/.*, .*build.*, .*/tmp/.*, .*/resources/.*, .*/res/.*"
parallel = true
}
dependencies {
ktlint "com.pinterest:ktlint:0.36.0"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
kaptAndroidTest "com.google.dagger:dagger-compiler:$daggerVersion"
implementation fileTree(include: ['**/*.jar'], dir: 'libs')
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.lifecycle:lifecycle-process:2.2.0"
implementation "android.arch.work:work-runtime-ktx:$workManagerVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$kotlinCoroutinesVersion"
implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
implementation("io.reactivex.rxjava2:rxandroid:2.1.1") {
exclude group: "io.reactivex.rxjava2", module: "rxjava"
}
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
implementation("com.squareup.retrofit2:converter-simplexml:$retrofitVersion") {
exclude group: "stax", module: "stax-api"
exclude group: "stax", module: "stax"
exclude group: "xpp3", module: "xpp3"
}
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6"
implementation "com.clover.sdk:clover-android-sdk:$cloverVersion"
implementation "com.clover.sdk:clover-android-connector-sdk:$cloverVersion"
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation "com.amazonaws:aws-android-sdk-core:$awsSdkVersion"
implementation "com.amazonaws:aws-android-sdk-pinpoint:$awsSdkVersion"
implementation("com.amazonaws:aws-android-sdk-mobile-client:$awsSdkVersion@aar") {
transitive = true
}
implementation "com.amazonaws:aws-android-sdk-s3:$awsSdkVersion"
implementation "com.amazonaws:aws-android-sdk-appsync:$awsAppSyncSdkVersion"
implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0"
implementation "org.eclipse.paho:org.eclipse.paho.android.service:1.1.1"
implementation "org.greenrobot:eventbus:3.1.1"
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
implementation("com.madgag.spongycastle:prov:1.58.0.0") {
exclude group: "junit"
}
implementation "com.auth0.android:jwtdecode:1.4.0"
implementation "net.grandcentrix.tray:tray:0.12.0"
implementation "org.threeten:threetenbp:1.4.1"
implementation("com.jakewharton.threetenabp:threetenabp:1.2.2") {
exclude module: "threetenbp"
}
implementation("com.github.joschi.jackson:jackson-datatype-threetenbp:2.8.4") {
exclude module: "threetenbp"
}
implementation "com.newrelic.agent.android:android-agent:$newRelicVersion"
implementation "com.journeyapps:zxing-android-embedded:3.6.0"
implementation "com.g00fy2:versioncompare:1.3.4"
implementation "com.airbnb.android:lottie:3.3.1"
implementation project(":app:libs:clover:roam")
implementation("com.firstdata.clovergo:remote-pay-android-go-connector:3.3.1.4@aar") {
transitive = true
}
implementation('io.branch.sdk.android:library:4.3.2') {
exclude module: "bbpos"
}
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
compileOnly "org.glassfish:javax.annotation:10.0-b28"
runtimeOnly "com.noveogroup.android:android-logger:$androidLoggerVersion"
testImplementation "org.slf4j:slf4j-simple:$slf4jVersion"
testImplementation "org.slf4j:jcl-over-slf4j:$slf4jVersion"
testImplementation "org.hamcrest:hamcrest-junit:2.0.0.0"
testImplementation("org.mockito:mockito-core:$mockitoVersion") {
exclude group: "net.bytebuddy"
}
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlinVersion") {
exclude group: "org.jetbrains.kotlin"
exclude group: "org.mockito"
}
testImplementation "net.bytebuddy:byte-buddy-android:$byteBuddyVersion"
testImplementation "net.bytebuddy:byte-buddy-agent:$byteBuddyVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion"
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "androidx.test:rules:1.2.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
androidTestImplementation "androidx.multidex:multidex-instrumentation:2.0.0"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
androidTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion") {
exclude module: "material"
exclude module: "appcompat"
exclude module: "recyclerview"
exclude module: "cardview"
}
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
androidTestImplementation "android.arch.work:work-testing:$workManagerVersion"
androidTestImplementation "com.google.dagger:dagger:$daggerVersion"
androidTestImplementation "org.awaitility:awaitility:3.1.6"
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$okHttpVersion"
androidTestImplementation("org.mockito:mockito-android:$mockitoVersion") {
exclude group: "net.bytebuddy"
}
androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlinVersion") {
exclude group: "org.jetbrains.kotlin"
exclude group: "org.mockito"
}
androidTestImplementation "net.bytebuddy:byte-buddy-android:$byteBuddyVersion"
androidTestImplementation "net.bytebuddy:byte-buddy-agent:$byteBuddyVersion"
androidTestImplementation "com.squareup.spoon:spoon-client:1.7.1"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion"
}
android.unitTestVariants.all { variant ->
variant.getRuntimeConfiguration().exclude group: "com.noveogroup.android", module: "android-logger"
}
好吧,这是一个有趣的问题,留下这个问题,以防有人遇到类似的问题。
在这种情况下,我们得到的错误消息似乎具有误导性。帮助诊断此类错误的一个好方法是查看崩溃留下的墓碑,请参阅 https://source.android.com/devices/tech/debug/native-crash 了解更多相关信息
在这种情况下,proguard 是我们的敌人,它似乎正在对测试代码执行某种优化,导致变量分配不正确,并通过添加解决 -optimizations *other optimizations*,!code/allocation/variable
这可能不适用于您的特定情况,但也许可以尝试将混淆器配置为不进行优化,看看是否有帮助:D
这是一个较大的 3-4 年 运行ning Android 项目,运行ning Gradle 5.4.1。集成测试使用 Mockito、espresso 和 dagger。
我有 运行 问题,我们正在向项目添加 Pendo 库,依赖项已作为标准添加到 Gradle。一切 运行 都很好,直到我们尝试 运行 集成测试(~2000),这些 运行 在 Spoon 的碎片中。
大约在集成测试进行到一半时,在每次随机测试中,由于 LinearAlloc 超出容量,我们 运行 进入本机崩溃并终止测试 运行。 运行 这些测试是孤立的,或者在他们的 类 本地测试中,它们毫无问题地通过了,并且已经稳定了很长时间。
我将整个应用程序恢复到已知的良好构建,仅添加了 Pendo 依赖项,这导致了同样的问题,但我不认为这是由于 Pendo,因为我通过返回测试已知良好的构建(此时再次测试以确保完整性)并添加一个随机的新依赖项,这导致了同样的问题。
据我所知,这可能与 Android 周围的方法限制有关。我应该提到我们正在使用 multidex 来分解应用程序。 Proguard 和 minify 也在使用中。
这里的部分问题是我真的不确定要看什么才能弄清楚是什么原因导致了这种溢出。按照测试 运行s 的日志,似乎没有什么不对劲,除了相当多的垃圾收集(我猜这意味着某处有泄漏)。我不确定这个问题是否归结为一些潜在的泄漏,以及新库是否正在将某些东西推到边缘,或者是否存在我不知道的 android 中的一些依赖限制,或者其他一些方式分解文件,这样我们就不会导致 LinearAlloc 填满。
通过阅读,我知道 LinearAlloc 的限制在 Android 5 左右提高了,我们在高于 (Android 10) 和低于此 (Android 4) 的设备上都遇到了问题) 并且自 2017 年以来我并没有看到太多关于此的讨论,所以我觉得我遗漏了一些明显的东西,或者项目中的某些东西配置错误,因为它是在那之前设置的。
任何帮助将不胜感激。我在下面转储了 gradle 文件的精简版
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
sourceSets {
main.java.srcDirs += "src/main/kotlin"
main.jniLibs.srcDirs = ["src/main/jni"]
androidTest.java.srcDirs += ["src/androidTest/kotlin", "src/testUtilities/kotlin"]
debug.java.srcDirs += "src/debug/kotlin"
test.java.srcDirs += ["src/test/kotlin", "src/testUtilities/kotlin"]
}
defaultConfig {
minSdkVersion 17
targetSdkVersion 25 // Required to be sdk 25
versionCode 94
versionName "3.4.0"
versionNameSuffix System.getenv("ANDROID_VERSION_NAME_SUFFIX") ?: ""
multiDexEnabled true
multiDexKeepProguard file("multidex-keep-rules.pro")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testBuildType "debug"
renderscriptTargetApi 17
renderscriptSupportModeEnabled false
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
exclude "META-INF/ASL2.0"
exclude "META-INF/LICENSE"
exclude "META-INF/NOTICE"
exclude "META-INF/NOTICE.txt"
exclude "META-INF/LICENSE.txt"
exclude "META-INF/MANIFEST.MF"
exclude "META-INF/main.kotlin_module"
exclude "META-INF/proguard/androidx-annotations.pro"
exclude "META-INF/atomicfu.kotlin_module"
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
testCoverageEnabled = false
applicationIdSuffix = '.dev'
versionNameSuffix "-debug"
manifestPlaceholders = [isDebug: true]
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
manifestPlaceholders = [isDebug: false]
}
}
dataBinding {
enabled = true
}
testOptions {
animationsDisabled = true
}
lintOptions {
checkDependencies = false
checkGeneratedSources = false
ignoreTestSources = true
disable "ExpiredTargetSdkVersion"
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
composer {
variants "debug"
shard true
withOrchestrator false
verboseOutput false
keepOutput true
if (project.hasProperty("composerClassTarget")) {
instrumentationArgument("class", project.getProperty("composerClassTarget"))
}
}
configurations {
ktlint
}
task ktlint(type: JavaExec) {
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
}
check.dependsOn ktlint
detekt {
input = files("$project.projectDir/src")
config = files("$project.projectDir/detekt.yml")
filters = ".*/testUtilities/.*, .*build.*, .*/tmp/.*, .*/resources/.*, .*/res/.*"
parallel = true
}
dependencies {
ktlint "com.pinterest:ktlint:0.36.0"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
kaptAndroidTest "com.google.dagger:dagger-compiler:$daggerVersion"
implementation fileTree(include: ['**/*.jar'], dir: 'libs')
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.lifecycle:lifecycle-process:2.2.0"
implementation "android.arch.work:work-runtime-ktx:$workManagerVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$kotlinCoroutinesVersion"
implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
implementation("io.reactivex.rxjava2:rxandroid:2.1.1") {
exclude group: "io.reactivex.rxjava2", module: "rxjava"
}
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
implementation("com.squareup.retrofit2:converter-simplexml:$retrofitVersion") {
exclude group: "stax", module: "stax-api"
exclude group: "stax", module: "stax"
exclude group: "xpp3", module: "xpp3"
}
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6"
implementation "com.clover.sdk:clover-android-sdk:$cloverVersion"
implementation "com.clover.sdk:clover-android-connector-sdk:$cloverVersion"
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation "com.amazonaws:aws-android-sdk-core:$awsSdkVersion"
implementation "com.amazonaws:aws-android-sdk-pinpoint:$awsSdkVersion"
implementation("com.amazonaws:aws-android-sdk-mobile-client:$awsSdkVersion@aar") {
transitive = true
}
implementation "com.amazonaws:aws-android-sdk-s3:$awsSdkVersion"
implementation "com.amazonaws:aws-android-sdk-appsync:$awsAppSyncSdkVersion"
implementation "org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0"
implementation "org.eclipse.paho:org.eclipse.paho.android.service:1.1.1"
implementation "org.greenrobot:eventbus:3.1.1"
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
implementation("com.madgag.spongycastle:prov:1.58.0.0") {
exclude group: "junit"
}
implementation "com.auth0.android:jwtdecode:1.4.0"
implementation "net.grandcentrix.tray:tray:0.12.0"
implementation "org.threeten:threetenbp:1.4.1"
implementation("com.jakewharton.threetenabp:threetenabp:1.2.2") {
exclude module: "threetenbp"
}
implementation("com.github.joschi.jackson:jackson-datatype-threetenbp:2.8.4") {
exclude module: "threetenbp"
}
implementation "com.newrelic.agent.android:android-agent:$newRelicVersion"
implementation "com.journeyapps:zxing-android-embedded:3.6.0"
implementation "com.g00fy2:versioncompare:1.3.4"
implementation "com.airbnb.android:lottie:3.3.1"
implementation project(":app:libs:clover:roam")
implementation("com.firstdata.clovergo:remote-pay-android-go-connector:3.3.1.4@aar") {
transitive = true
}
implementation('io.branch.sdk.android:library:4.3.2') {
exclude module: "bbpos"
}
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
compileOnly "org.glassfish:javax.annotation:10.0-b28"
runtimeOnly "com.noveogroup.android:android-logger:$androidLoggerVersion"
testImplementation "org.slf4j:slf4j-simple:$slf4jVersion"
testImplementation "org.slf4j:jcl-over-slf4j:$slf4jVersion"
testImplementation "org.hamcrest:hamcrest-junit:2.0.0.0"
testImplementation("org.mockito:mockito-core:$mockitoVersion") {
exclude group: "net.bytebuddy"
}
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlinVersion") {
exclude group: "org.jetbrains.kotlin"
exclude group: "org.mockito"
}
testImplementation "net.bytebuddy:byte-buddy-android:$byteBuddyVersion"
testImplementation "net.bytebuddy:byte-buddy-agent:$byteBuddyVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion"
androidTestImplementation "androidx.test:runner:1.2.0"
androidTestImplementation "androidx.test:rules:1.2.0"
androidTestImplementation "androidx.test.uiautomator:uiautomator:2.2.0"
androidTestImplementation "androidx.multidex:multidex-instrumentation:2.0.0"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
androidTestImplementation("androidx.test.espresso:espresso-contrib:$espressoVersion") {
exclude module: "material"
exclude module: "appcompat"
exclude module: "recyclerview"
exclude module: "cardview"
}
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
androidTestImplementation "android.arch.work:work-testing:$workManagerVersion"
androidTestImplementation "com.google.dagger:dagger:$daggerVersion"
androidTestImplementation "org.awaitility:awaitility:3.1.6"
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$okHttpVersion"
androidTestImplementation("org.mockito:mockito-android:$mockitoVersion") {
exclude group: "net.bytebuddy"
}
androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockitoKotlinVersion") {
exclude group: "org.jetbrains.kotlin"
exclude group: "org.mockito"
}
androidTestImplementation "net.bytebuddy:byte-buddy-android:$byteBuddyVersion"
androidTestImplementation "net.bytebuddy:byte-buddy-agent:$byteBuddyVersion"
androidTestImplementation "com.squareup.spoon:spoon-client:1.7.1"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutinesVersion"
}
android.unitTestVariants.all { variant ->
variant.getRuntimeConfiguration().exclude group: "com.noveogroup.android", module: "android-logger"
}
好吧,这是一个有趣的问题,留下这个问题,以防有人遇到类似的问题。
在这种情况下,我们得到的错误消息似乎具有误导性。帮助诊断此类错误的一个好方法是查看崩溃留下的墓碑,请参阅 https://source.android.com/devices/tech/debug/native-crash 了解更多相关信息
在这种情况下,proguard 是我们的敌人,它似乎正在对测试代码执行某种优化,导致变量分配不正确,并通过添加解决 -optimizations *other optimizations*,!code/allocation/variable
这可能不适用于您的特定情况,但也许可以尝试将混淆器配置为不进行优化,看看是否有帮助:D