问题
When i build a new APK or generate a signed APK in release mode I get the following error:
Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.1.4): No cached version available for offline mode
This is my Gradle code:
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'
}
I am not using Kotlin, just regular Java Android.
What should I do to fix this issue?
回答1:
1) make sure you are connected to the internet.
2) go to file->settings->build, execution, deployment -> gradle -> make sure you have unchecked the "offline work" checkbox
3) rebuild the project and try build apk again
来源:https://stackoverflow.com/questions/51878497/java-android-apk-release-mode-error-could-not-download-kotlin-compiler-jar