简体   繁体   English

android studio generate signed apk 问题(找不到kotlin-compiler-27.0.1.jar)

[英]android studio generate signed apk problem ( Could not find kotlin-compiler-27.0.1.jar )

when i want to generate signed apk (release version not debug version) in android studio, lead to this error:当我想在 android studio 中生成签名的 apk(发布版本而不是调试版本)时,导致此错误:

Could not find kotlin-compiler-27.0.1.jar (com.android.tools.external.com-intellij:kotlin-compiler:27.0.1).找不到 kotlin-compiler-27.0.1.jar (com.android.tools.external.com-intellij:kotlin-compiler:27.0.1)。 Searched in the following locations: https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/27.0.1/kotlin-compiler-27.0.1.jar在以下位置搜索: https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/27.0.1/kotlin-compiler-27.0.1。 jar

build project and run has no error but generate signed apk show top error构建项目并运行没有错误,但生成签名的 apk 显示顶部错误

i had that problem in android studio version 3.6 and i updated to version 4.0.1 and gradle is 6.1.1 but nothing changed and i still have that error我在 android 工作室版本 3.6 中遇到了这个问题,我更新到版本 4.0.1 和 gradle 是 6.1.1 但没有任何改变,我仍然有这个错误

i also create empty new project and add no more code but when generate signed apk that error exist.. i don't use kotlin in my code我还创建了空的新项目并且不再添加代码,但是当生成签名 apk 时存在错误.. 我不在我的代码中使用 kotlin

my gradle content:我的 gradle 内容:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "com.example.testapp"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.1"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

You need use proxy or vpn to solve this problem.or can change:您需要使用代理或 vpn 来解决此问题。或者可以更改:

classpath "com.android.tools.build:gradle:4.0.1"

to

classpath "com.android.tools.build:gradle:4.0.0"

and use gradle plugin version 6.5并使用 gradle 插件版本 6.5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM