相关疑难解决方法(0)

Invoke-customs仅支持从android 0 --min-api 26开始

在我使用构建版本gradle 26之前,但在将buildtoolsversion更改为27之后就像这个图像一样 错误:错误构建gradle screenshot

android android-studio android-gradle-plugin

285
推荐指数
4
解决办法
8万
查看次数

Android Studio 3.0 DexArchiveBuilderException

编译仪器测试时我遇到了这个错误.

错误:com.android.builder.dexing.DexArchiveBuilderException:无法处理/Users/rafaelruizmunoz/SourceTree/Weather/app/build/intermediates/transforms/desugar/androidTest/debug/1.jar

错误:com.android.builder.dexing.DexArchiveBuilderException:dexing org/assertj/core/api/LongPredicateAssert.class时出错

错误:com.android.dx.cf.code.SimException:默认或静态接口方法,不使用--min-sdk-version> = 24

我试图multiDexEnabled在我的启用/禁用,build.gradle但没有任何帮助.

androidbuild.gradle:

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.**.weather"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}
Run Code Online (Sandbox Code Playgroud)

java android gradle android-studio

17
推荐指数
2
解决办法
1万
查看次数

仅在 androidTest 上:仅从 Android O 开始支持 Invoke-customs

我的代码库使用了一些 Java 8 语法,如 lambdas,并且已经运行了很长时间。

最近,我在一个模块中的仪器测试停止使用臭名昭著的消息:

AGPBI: {"kind":"error","text":"Invoke-customs 仅支持从 Android O (--min-api 26)","sources":[{}],"tool":" D8"}

这是一个已知问题(有很多 问题参考它),但我的 1.8 中有 Java compileOptions

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
Run Code Online (Sandbox Code Playgroud)

这个问题只出现在仪器测试(即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'
}
Run Code Online (Sandbox Code Playgroud)

我正在使用最新的编译和目标版本(我也尝试了 26 和 27)并且还构建了工具。最小 SDK 版本是 14,应该是。

compileSdkVersion 28 …
Run Code Online (Sandbox Code Playgroud)

java android android-testing android-gradle-plugin

5
推荐指数
1
解决办法
4089
查看次数