gpt4 book ai didi

java - 仅在 androidTest : Invoke-customs are only supported starting with Android O

转载 作者:搜寻专家 更新时间:2023-11-01 09:20:37 24 4
gpt4 key购买 nike

我的代码库使用了一些 Java 8 语法,例如 lambda,并且在很长一段时间内都运行良好。

最近,我在一个模块中的插桩测试停止了臭名昭著的消息:

AGPBI: {"kind":"error","text":"Invoke-customs are only supported starting with Android O (--min-api 26)","sources":[{}],"tool":"D8"}

这是一个已知问题(有 many questions 引用它),但我的 compileOptions 中有 Java 1.8:

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

此问题仅出现在插桩测试(即 androidTest)中。单元测试和应用程序本身都很好。我已经注释掉了插桩测试中的所有测试,但问题仍然存在。

我的单元测试和 Android 测试具有相同的依赖关系。我转换为 AndroidX 测试,但问题仍然存在。

dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'

androidTestImplementation 'org.mockito:mockito-core:2.27.0'
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.ext:truth:1.1.0'
androidTestImplementation 'com.google.truth:truth:0.42'

testImplementation 'org.mockito:mockito-core:2.27.0'
testImplementation 'androidx.test:core:1.1.0'
testImplementation 'androidx.test:runner:1.1.1'
testImplementation 'androidx.test:rules:1.1.1'
testImplementation 'androidx.test.ext:junit:1.1.0'
testImplementation 'androidx.test.ext:truth:1.1.0'
testImplementation 'com.google.truth:truth:0.42'
}

我使用的是最新的编译和目标版本(我也尝试过 26 和 27)以及构建工具。最低 SDK 版本为 14,应该是。

compileSdkVersion 28
buildToolsVersion '29.0.0 rc3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
}

最佳答案

这是 Android Studio 3.5 测试版中的错误。我提交了 bug with the Android Studio team ,这将通过 Android Studio 3.5 beta 03 构建工具修复。

关于java - 仅在 androidTest : Invoke-customs are only supported starting with Android O,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56104739/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com