失败:构建失败,发生异常。 -科尔多瓦

时间:2019-04-13 19:08:46

标签: android cordova

我创建了一个新项目。我安装了“浏览器/ Android”作为平台。 仅安装标准插件; cordova-plugin-device 2.0.2“设备” cordova-plugin-whitelist 1.3.3“白名单”

它可以在浏览器中顺利进行编译。 (该项目已经是空心的) 但是,当我想在android设备上进行编译时,无法获得结果。输出如下。我也分享SDK信息。我不知道我在哪里犯错。

SDK Screenshot

C:\MyApp>cordova run android -device

Checking Java JDK and Android SDK versions 

ANDROID_SDK_ROOT=undefined (recommended setting)

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk (DEPRECATED)

Subproject Path: CordovaLib

Subproject Path: app

> Configure project :app
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as i
t is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.
0.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gr
adle file, as each version of the Android Gradle Plugin now has a default versio
n of the build tools.
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\25.0.1\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\25.0.2\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\25.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.1\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.2\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\28.0.2\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\an
droid\m2repository\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\auto\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\google_play_services\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\instantapps\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\m2repository\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\market_apk_expansion\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\market_licensing\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\simulators\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\usb_driver\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\webdriver\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platform-
tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-23\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-25\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-26\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-27\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-Q\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\system-im
ages\android-28\android-tv\x86\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\system-im
ages\android-28\default\x86_64\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\tools\pac
kage.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\25.0.1\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\25.0.2\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\25.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.0\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.1\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.2\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\26.0.3\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\build-too
ls\28.0.2\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\an
droid\m2repository\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\auto\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\google_play_services\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\instantapps\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\m2repository\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\market_apk_expansion\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\market_licensing\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\simulators\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\usb_driver\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\extras\go
ogle\webdriver\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platform-
tools\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-23\package.xml. Probably the SDK is read-only

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not
 been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
  To build this project, accept the SDK license agreements and install the missi
ng components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to anot
her, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: C:\Program Files (x86)\Android\android-sdk

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

* Get more help at https://help.gradle.org

BU?LD FAILED in 1s
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-25\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-26\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-27\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-28\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\platforms
\android-Q\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\system-im
ages\android-28\android-tv\x86\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\system-im
ages\android-28\default\x86_64\package.xml. Probably the SDK is read-only
Exception while marshalling C:\Program Files (x86)\Android\android-sdk\tools\pac
kage.xml. Probably the SDK is read-only
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Program Fi
les (x86)\Android\android-sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
C:\MyApp\platforms\android\gradlew: Command failed with exit code 1 Error output
:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not
 been accepted.
     build-tools;28.0.3 Android SDK Build-Tools 28.0.3
  To build this project, accept the SDK license agreements and install the missi
ng components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to anot
her, see http://d.android.com/r/studio-ui/export-licenses.html

  Using Android SDK: C:\Program Files (x86)\Android\android-sdk

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

* Get more help at https://help.gradle.org

BU?LD FAILED in 1s

C:\MyApp>

1 个答案:

答案 0 :(得分:0)

在您的Android SDK Build Tools上,卸载28.0.2版并安装28.0.3版。

这些位于您的屏幕快照1st Window中的第3个和第4个软件包中。

当科尔多瓦发布错误Probably the SDK is read-only时,似乎无权执行此操作。

另一种可能的解决方案是以管理员身份启动cmd,然后重试。