не удалось создать приложение для выполнения задачи»: приложение:compileDebugJavaWithJavac»

#android #cordova #build

Вопрос:

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

«Не удалось выполнить задачу»: compileDebugJavaWithJavac».».
Я установил Android Studio версии 4.2.1 в Windows 10. Мой 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:UsersMSAppDataRoamingnpmnode_modulesionic)
   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:UsersMSAppDataLocalAndroidSdk)
   NodeJS            : v14.17.1 (C:Program Filesnodejsnode.exe)
   npm               : 7.18.1
   OS                : Windows 10```


 

Ответ №1:

Добавьте нижеприведенную строку в свой объект gradle.property и запустите снова

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