我正在使用 cordova https://cordova.apache.org/ 构建移动应用程序,即使在更新 build.gradle 之后,我尝试为 android 平台构建时也遇到错误。下面我显示了错误。
cordova --version 10.0.0
Android 调试桥版本 1.0.41
版本 31.0.2-7242960
> Task :app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Failed to transform isoparser-1.1.17.jar to match attributes {artifactType=android-classes-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\voicegab\platforms\android\app\libs\isoparser-1.1.17.jar.
> Failed to transform 'C:\voicegab\platforms\android\app\libs\isoparser-1.1.17.jar' using Jetifier. Reason: ZipException, message: invalid distance too far back. (Run with --stacktrace for more details.)
Please file a bug at http://issuetracker.google.com/issues/new?component=460323.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 3s
21 actionable tasks: 1 executed, 20 up-to-date
Command failed with exit code 1: C:\voicegab\platforms\android\gradlew cdvBuildDebug -b C:\voicegab\platforms\android\build.gradle
我已经在 platform/android/build.gradle 中更新了我的 gradle 构建文件
buildscript {
ext.kotlin_version = '1.3.50'
apply from: 'repositories.gradle'
repositories {
maven { url "https://maven.google.com" }
jcenter { url "http://jcenter.bintray.com/"}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
apply from: 'repositories.gradle'
repositories {
maven { url "https://maven.google.com" }
jcenter { url "http://jcenter.bintray.com/"}
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="29.0.2" //String
defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
}