任务“:app:compileDebugJavaWithJavac”的应用程序未构建执行失败

时间:2021-06-22 07:08:50

标签: android cordova build

 I cannot build the app after i installed cordova plugin. Getting the following error

“任务 ':compileDebugJavaWithJavac' 执行失败。”。 我在 Windows 10 上安装了 Android Studio 版本 4.2.1。我的 Gradle 在尝试了大约 2 天后没有构建。我有一个我不明白的问题。

我试过 platfrom 删除并再次添加但得到同样的错误,也改变了离子版本但没有解决这个问题

    ext.kotlin_version = '1.3.50'
    apply from: 'repositories.gradle'
    repositories repos

    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 repos

    //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
    }
}

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

   ionic (Ionic CLI)             : 4.3.0 (C:\Users\MS\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 5.5.3
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   cordova (Cordova CLI) : 10.0.0
   Cordova Platforms     : 6.0.0, android 9.1.0, browser
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 14 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\MS\AppData\Local\Android\Sdk)
   NodeJS            : v14.17.1 (C:\Program Files\nodejs\node.exe)
   npm               : 7.18.1
   OS                : Windows 10```


1 个答案:

答案 0 :(得分:0)

在 gradle.property 中添加以下行并再次运行

org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home