我正在尝试使用离子制作Android的应用程序,我安装了Android SDK Manager并完成了所有更新然后我安装了Android Studio, 然后我跟着this guide建立了应用程序(我之前做过离子cordova平台添加android) 我在Windows 7 64位上运行,使用Ionic 3.20.0和Cordova 8.0.0 这是git Bash展示的内容:
$ ionic cordova build --release android
Running app-scripts build: --platform android --target cordova
[12:42:03] build dev started ...
[12:42:03] clean started ...
[12:42:03] clean finished in 15 ms
[12:42:03] copy started ...
[12:42:03] deeplinks started ...
[12:42:03] deeplinks finished in 46 ms
[12:42:03] transpile started ...
[12:42:10] transpile finished in 6.79 s
[12:42:10] preprocess started ...
[12:42:10] preprocess finished in less than 1 ms
[12:42:10] webpack started ...
[12:42:10] copy finished in 7.05 s
[12:42:20] webpack finished in 9.41 s
[12:42:20] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[12:42:21] sass finished in 1.42 s
[12:42:21] postprocess started ...
[12:42:21] postprocess finished in 171 ms
[12:42:21] lint started ...
[12:42:21] build dev finished in 17.99 s
> cordova build android --release
Android Studio project detected
ANDROID_HOME=C:\Users\DELL\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112
studio
Subproject Path: CordovaLib
Subproject Path: app
[12:42:26] lint finished in 5.26 s
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Checking the license for package Android SDK Platform 26 in C:\Users\DELL\AppData\Local\Android\android-sdk\licenses
Warning: License for package Android SDK Platform 26 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 26].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
(node:6316) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 26].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
at ChildProcess.whenDone (C:\Users\DELL\Desktop\ecrypt\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:6316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
答案 0 :(得分:0)
转到
~/Library/Android/sdk/tools/bin
并按如下方式运行sdkmanager:
./sdkmanager --licenses
并接受您不接受的许可证。