Visual Studio 2015 + Cordova環境のAndroidビルドでCordovaLib:compileReleaseJavaWithJavac のビルドに失敗して困っていましたが、解決しましたので、解決方法について記載します。
1>------ すべてのリビルド開始: プロジェクト:PronamaChanMineSweeper, 構成:Release Android ------ 1> ANDROID_HOME=C:¥Program Files (x86)¥Android¥android-sdk 1> JAVA_HOME=C:¥Program Files¥Android¥Android Studio¥jre 1> :clean 1> :CordovaLib:clean 1> 1> BUILD SUCCESSFUL 1> 1> Total time: 4.22 secs 1> Picked up _JAVA_OPTIONS: -Xmx512M 1> ------ ソース パッケージ ディレクトリからパッケージが正しくグローバルにインストールされていることを確認しています: C:¥Program Files (x86)¥Microsoft Visual Studio 14.0¥Common7¥IDE¥Extensions¥ApacheCordovaTools¥packages¥vs-tac 1> ------ ソースの package.json の名前: vs-tac 1> ------ ソースの package.json のバージョン: 1.0.42 1> ------ パッケージは既に正しいバージョンでグローバルにインストールされています。 1> ------ Cordova ツール 6.2.0 は既にインストールされています。 1> ------ Build Settings: 1> ------ Build Settings: 1> ------ platformConfigurationBldDir: -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥bld¥Android¥Release 1> ------ platformConfigurationBinDir: -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥bin¥Android¥Release 1> ------ buildCommand: build 1> ------ platform: Android 1> ------ cordovaPlatform: android 1> ------ configuration: Release 1> ------ cordovaConfiguration: Release 1> ------ projectName: PronamaChanMineSweeper 1> ------ projectSourceDir: -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper 1> ------ npmInstallDir: C:¥Users¥honpu¥AppData¥Roaming¥npm 1> ------ buildTarget: AndroidEmulator 1> ------ language: ja-JP 1> ------ プラットフォーム android は既に存在しています 1> ------ プラグインを更新しています 1> ------ 現在インストールされているプラグイン: cordova-plugin-compat@1.1.0,cordova-plugin-inappbrowser@2.0.2 1> ------ 現在インストールされている依存プラグイン: 1> ------ 現在構成されているプラグイン: 1> ------ 準備中のプラットフォーム: android 1> No scripts found for hook "before_build". 1> No scripts found for hook "before_prepare". 1> Checking config.xml for saved platforms that haven't been added to the project 1> Checking for any plugins added to the project that have not been installed in android platform 1> No differences found between plugins added to project and installed in android platform. Continuing... 1> Generating config.xml from defaults for platform "android" 1> Found "merges" for android platform. Copying over existing "www" files. 1> Wrote out Android application name to "プロ生ちゃんマインスイーパー" 1> Wrote out Android package name to "wabiapp.com.PronamaChanMineSweeper" 1> This app does not have launcher icons defined 1> updated project successfully 1> No scripts found for hook "after_prepare". 1> Checking config.xml for saved plugins that haven't been added to the project 1> ------ -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥bin¥Android¥Release¥VSBuildInfo.xml を platforms¥android¥assets¥www¥VSBuildInfo.xml にコピーしました 1> ------ ビルド中のプラットフォーム: android 1> Release 1> ------ ビルドの構成オプション: --release 1> No scripts found for hook "before_compile". 1> ANDROID_HOME=C:¥Program Files (x86)¥Android¥android-sdk 1> JAVA_HOME=C:¥Program Files¥Android¥Android Studio¥jre 1> Reading build config file: -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥build.json 1> Reading the keystore from: c:¥org¥android.keystore 1> :preBuild UP-TO-DATE 1> :preReleaseBuild UP-TO-DATE 1> :checkReleaseManifest 1> :CordovaLib:preBuild UP-TO-DATE 1> :CordovaLib:preReleaseBuild UP-TO-DATE 1> :CordovaLib:compileReleaseNdk UP-TO-DATE 1> :CordovaLib:compileLint 1> :CordovaLib:copyReleaseLint UP-TO-DATE 1> :CordovaLib:mergeReleaseProguardFiles UP-TO-DATE 1> :CordovaLib:packageReleaseRenderscript UP-TO-DATE 1> :CordovaLib:checkReleaseManifest 1> :CordovaLib:prepareReleaseDependencies 1> :CordovaLib:compileReleaseRenderscript 1> :CordovaLib:generateReleaseResValues UP-TO-DATE 1> :CordovaLib:generateReleaseResources 1> :CordovaLib:packageReleaseResources 1> :CordovaLib:compileReleaseAidl 1> :CordovaLib:generateReleaseBuildConfig 1> :CordovaLib:generateReleaseAssets UP-TO-DATE 1> :CordovaLib:mergeReleaseAssets 1> :CordovaLib:processReleaseManifest 1> :CordovaLib:processReleaseResources 1> :CordovaLib:generateReleaseSources 1> :CordovaLib:compileReleaseJavaWithJavac FAILED 1> 1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception. 1> FAILURE: Build failed with an exception. 1> 1> BUILD FAILED 1> 1> Total time: 3.575 secs 1> 1>MSBUILD : cordova-build error : * What went wrong: 1> * What went wrong: 1>MSBUILD : cordova-build error : Execution failed for task ':CordovaLib:compileReleaseJavaWithJavac'. 1> Execution failed for task ':CordovaLib:compileReleaseJavaWithJavac'. 1>MSBUILD : cordova-build error : > Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory. 1> > Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory. 1> 1>MSBUILD : cordova-build error : * Try: 1> * Try: 1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 1> Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 1>MSBUILD : cordova-build error : Error code 1 for command: cmd with args: /s,/c,"-:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥platforms¥android¥gradlew cdvBuildRelease -b -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥platforms¥android¥build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" 1> Error code 1 for command: cmd with args: /s,/c,"-:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥platforms¥android¥gradlew cdvBuildRelease -b -:----¥WabiStoreApps¥PronamaChanMineSweeper¥PronamaChanMineSweeper¥platforms¥android¥build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" ========== すべてリビルド: 0 正常終了、1 失敗、0 スキップ ==========
これは、JAVA_HOMEが、Javaのフォルダでは無く、Android Studioのjreを指している為に発生しています。 JAVA_HOME=C:¥Program Files¥Android¥Android Studio¥jre
を正しいJavaのパスに書き換えましょう。
これで、CordovaLib:compileReleaseJavaWithJavacのビルドが通るようになります。