当我在 Release模式下构建新的 APK 或生成签名的 APK 时,出现以下错误:
无法下载 kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.1.4):没有可用于离线模式的缓存版本
这是我的 Gradle 代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.caro.customelements"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
我没有使用 Kotlin,只是使用普通的 Java Android。
我应该怎么做才能解决这个问题?
最佳答案
1) 确保您已连接到互联网。
2) 转到文件->设置->构建、执行、部署->gradle->确保您没有选中“离线工作”复选框
3) 重建项目并再次尝试构建 apk
关于android - JAVA Android APK Release模式报错Could not download kotlin-compiler.jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51878497/