问题描述
当我构建一个新的APK或在释放模式下生成签名的APK时,我收到以下错误:
无法下载kotlin-compiler.jar(com.android.tools.external.com-Intellij:Kotlin-Compiler:26.1.4):没有可用于离线模式的缓存版本
这是我的GREDLE代码:
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)确保您连接到Internet.
2)转到文件 - >设置 - >构建,执行,部署 - > Gradle - >确保您未选中"脱机工作"复选框
3)重建项目并再次尝试构建APK
问题描述
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) 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