ionic android build: Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.

ionic build androidでのエラー:

Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.

詳細:

➜ test ionic build android
Running command: /Users/local/ionic_projects/test/hooks/after_prepare/010_add_platform_class.js /Users/local/ionic_projects/test
add to body class: platform-android
Error: Please install Android target: "android-23".

Hint: Open the SDK manager by running: /Users/local/Library/Android/sdk/tools/android
You will require:
1. "SDK Platform" for android-23
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)
➜ test ionic build android
Running command: /Users/local/ionic_projects/test/hooks/after_prepare/010_add_platform_class.js /Users/local/ionic_projects/test
add to body class: platform-android
ANDROID_HOME=/Users/local/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac/Users/local/ionic_projects/test/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:222: error: cannot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String,int)
location: class Activity
/Users/local/ionic_projects/test/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:228: error: cannot find symbol
getActivity().requestPermissions(permissions, requestCode);
^
symbol: method requestPermissions(String
,int)
location: class Activity
/Users/local/ionic_projects/test/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:233: error: cannot find symbol
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
^
symbol: variable M
location: class VERSION_CODES
/Users/local/ionic_projects/test/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java:235: error: cannot find symbol
int result = activity.checkSelfPermission(permission);
^
symbol: method checkSelfPermission(String)
location: variable activity of type Activity
/Users/local/ionic_projects/test/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java:493: error: method does not override or implement a method from a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.946 secs
Error: Error code 1 for command: /Users/local/ionic_projects/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/local/ionic_projects/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

 

解決策1:

stackoverflow.com

 

解決策2;

Android Studio> Preferences>AppearanceからSDKの最新版をインストール

 

もと:

ionicframework.com