简体   繁体   中英

FAILURE: Build failed with an exception. - Cordova

I've created a new project. I installed "Browser / Android" as the platform. Only standard plug-ins installed; cordova-plugin-device 2.0.2 "Device" cordova-plugin-whitelist 1.3.3 "Whitelist"

It makes a smooth compilation in the browser. (The project is already hollow) However, I can't get results when I want to compile on android device. The output is as follows. I also share SDK information. I don't know where I'm making a mistake.

SDK萤幕撷取画面

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>

At your Android SDK Build Tools uninstall version 28.0.2 and install version 28.0.3.

These are in your screenshot 1st Window the 3rd and the 4th packages.

It looks that cordova does not have the permission to do it as it posts the error Probably the SDK is read-only .

Another possible solution for that is to start the cmd as an administrator and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM