【发布时间】:2025-12-06 02:45:02
【问题描述】:
启用插孔时出现以下错误
错误:Jar 转换:来自不受支持的 Java 版本的类文件错误:任务执行失败 ':app:transformClassesWithPreJackPackagedLibrariesForDebug'。 com.android.build.api.transform.TransformException:com.android.builder.core.JackToolchain$ToolchainException:杰克 编译异常
我的构建等级
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "pl.develhopper.jaxygenaddclientlib"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
jackOptions { // DEPRECATED
enabled true
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.gson:gson:2.8.2'
compile 'javax.xml.bind:jaxb-api:2.3.0'
testCompile 'junit:junit:4.12'
}
有人遇到过这样的错误吗?它来自哪里?
【问题讨论】:
-
Jack 编译无论如何都被弃用了
-
还有其他选项可以使用 java 8 运行 android 项目吗?因为如果我将 target 和 sourceCompatibility 设置为 1.8,我会收到此错误 Error:Jack is required to support java 8 language features。启用 Jack 或删除 sourceCompatibility JavaVersion.VERSION_1_8。
标签: android android-gradle-plugin build.gradle