Android-runtime: Build error: gradlew.bat failed with exit code 1

Created on 8 Sep 2016  ยท  29Comments  ยท  Source: NativeScript/android-runtime

Hi,
After a few months of doing other projects and enjoying the summer I decided to get back to work on my Nativescript project. Reading the documentation, I decided to update to version 2.2.1. Armed with the update manual I followed the instuctions. But when building my project for the first time I noticed a build error: /gradlew.bat failed with exit code 1

Reading similar issues on stackoverflow.com and here I tried several options to resolve the issue, but no luck so far. Things I tried:

  • Instructions on Android plugins and Windows path size issues
  • Removing and adding the android platform (tns platform remove android, tns platform add android)
  • Removing the node_modules folder
  • Updating the Andoid SDK
  • gradlew clean in folder /platforms/android

Nothing helped. Anyone for a good hint?

Version numbers:
tns: 2.2.1
Cross-platform modules: 2.2.1
Package.json of project:

{
  "nativescript": {
    "id": "nl.progig.handsonlifesupport",
    "tns-android": {
      "version": "2.2.0"
    }
  },
  "dependencies": {
    "dateformat": "^1.0.12",
    "intl": "^1.1.0",
    "tns-android": "^2.2.0",
    "tns-core-modules": "^2.2.1"
  },
  "devDependencies": {
    "babel-traverse": "6.14.0",
    "babel-types": "6.14.0",
    "babylon": "6.9.1",
    "lazy": "1.0.11"
  }
}

--log trace output:

$ tns build android --log trace
execFile: D:\android-sdk\platform-tools\adb "help"
execFile: D:\android-sdk\platform-tools\adb "help"
spawn: D:\android-sdk\platform-tools\adb "--help"
Socket {
  _connecting: false,
  _hadError: false,
  _handle:
   Pipe {
     bytesRead: 0,
     _externalStream: {},
     fd: -1,
     writeQueueSize: 0,
     owner: [Circular],
     onread: [Function: onread],
     reading: true },
  _parent: null,
  _host: null,
  _readableState:
   ReadableState {
     objectMode: false,
     highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: null,
     ended: false,
     endEmitted: false,
     reading: true,
     sync: false,
     needReadable: true,
     emittedReadable: false,
     readableListening: false,
     resumeScheduled: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events:
   { end: { [Function: g] listener: [Function: onend] },
     finish: [Function: onSocketFinish],
     _socketEnd: [Function: onSocketEnd],
     close: [Function] },
  _eventsCount: 4,
  _maxListeners: undefined,
  _writableState:
   WritableState {
     objectMode: false,
     highWaterMark: 16384,
     needDrain: false,
     ending: false,
     ended: false,
     finished: false,
     decodeStrings: false,
     defaultEncoding: 'utf8',
     length: 0,
     writing: false,
     corked: 0,
     sync: true,
     bufferProcessing: false,
     onwrite: [Function],
     writecb: null,
     writelen: 0,
     bufferedRequest: null,
     lastBufferedRequest: null,
     pendingcb: 0,
     prefinished: false,
     errorEmitted: false,
     bufferedRequestCount: 0,
     corkedRequestsFree: CorkedRequest { next: null, entry: null, finish: [Function] } },
  writable: false,
  allowHalfOpen: false,
  destroyed: false,
  _bytesDispatched: 0,
  _sockname: null,
  _writev: null,
  _pendingData: null,
  _pendingEncoding: '',
  server: null,
  _server: null }
Exec npm -v
 stdout: 2.15.9

 stderr:
spawn: java "-version"
Exec node-gyp -v
 stdout:
 stderr: 'node-gyp' is not recognized as an internal or external command,
operable program or batch file.

Exec "D:\android-sdk\platform-tools\adb" version
 stdout: Android Debug Bridge version 1.0.36
Revision 8f855a3d9b35-android

 stderr:
spawn: D:\android-sdk\tools\android.bat "-h"
Result when throw error is false:
{ stdout: '\n       Usage:\n       android [global options] action [action options]\n       Global options:\n  -s --silent     : Silent mode, shows errors only.\n  -v --verbose    : Verbose mode, shows errors, warnings and all messages.\n     --clear-cache: Clear the SDK Manager repository manifest cache.\n  -h --help       : Help on a specific command.\n\n                                                                    Valid\n                                                                    actions\n                                                                    are\n                                                                    composed\n                                                                    of a verb\n                                                                    and an\n                                                                    optional\n                                                                    direct\n                                                                    object:\n-    sdk              : Displays the SDK Manager window.\n-    avd              : Displays the AVD Manager window.\n-   list              : Lists existing targets or virtual devices.\n-   list avd          : Lists existing Android Virtual Devices.\n-   list target       : Lists existing targets.\n-   list device       : Lists existing devices.\n-   list sdk          : Lists remote SDK repository.\n- create avd          : Creates a new Android Virtual Device.\n-   move avd          : Moves or renames an Android Virtual Device.\n- delete avd          : Deletes an Android Virtual Device.\n- update avd          : Updates an Android Virtual Device to match the folders\n                        of a new SDK.\n- create project      : Creates a new Android project.\n- update project      : Updates an Android project (must already have an\n                        AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n                        already have an AndroidManifest.xml).\n- create lib-project  : Creates a new Android library project.\n- update lib-project  : Updates an Android library project (must already have\n                        an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb          : Updates adb to support the USB devices declared in the\n                        SDK add-ons.\n- update sdk          : Updates the SDK by suggesting new platforms to install\n                        if available.\n',
  stderr: '',
  exitCode: 0 }
Exec mono --version
 stdout:
 stderr: 'mono' is not recognized as an internal or external command,
operable program or batch file.

Exec git --version
 stdout: git version 2.6.1.windows.1

 stderr:
Exec gradle -v
 stdout:
 stderr: 'gradle' is not recognized as an internal or external command,
operable program or batch file.

Exec "C:\Program Files\Java\jdk1.8.0_31\bin\javac" -version
 stdout:
 stderr: javac 1.8.0_31

System information:
{ procInfo: 'nativescript/2.2.1',
  platform: 'win32',
  os: 'Windows 8.1 Pro 6.3.9600',
  shell: 'C:\\WINDOWS\\system32\\cmd.exe',
  dotNetVer: '4.5.51650',
  procArch: 'x64',
  nodeVer: 'v4.5.0',
  npmVer: '2.15.9',
  javaVer: '1.8.0',
  nodeGypVer: null,
  xcodeVer: null,
  xcodeprojGemLocation: null,
  itunesInstalled: false,
  cocoapodVer: null,
  adbVer: 'Android Debug Bridge version 1.0.36',
  androidInstalled: true,
  monoVer: null,
  gitVer: '2.6.1.windows.1',
  gradleVer: null,
  javacVersion: '1.8.0_31' }
Starting watch on killswitch C:\Users\MyUserName\AppData\Local\Temp\MyUserName\KillSwitches\cli
Initializing analytics statuses.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track feature 'Non-interactive' with value 'build'.
Looking for project in 'D:\git\holsa-app'
Project directory is 'D:\git\holsa-app'.
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track feature 'Non-interactive' with value 'build|android'.
Hooks directories: [ 'C:\\Users\\MyUserName\\AppData\\Roaming\\npm\\node_modules\\nativescript\\lib\\hooks',
  'C:\\Users\\MyUserName\\AppData\\Roaming\\npm\\node_modules\\nativescript\\lib\\common\\hooks',
  'D:\\git\\holsa-app\\hooks' ]
BeforeHookName for command prepare is before-prepare
Existing AndroidManifest.xml is correct.
Existing AndroidManifest.xml is correct.
spawn: D:\android-sdk\tools\android.bat "list" "targets"
Result when throw error is false:
{ stdout: 'Available Android targets:\n----------\nid: 1 or "android-23"\n     Name: Android 6.0\n     Type: Platform\n     API level: 23\n     Revision: 3\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320\n Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/armeabi-v7a, default/x86, default/x86_64\n----------\nid: 2 or "android-24"\n     Name: Android 7.0\n     Type: Platform\n     API level: 24\n     Revision: 2\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320\n Tag/ABIs : android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/arm64-v8a, default/armeabi-v7a, default/x86, default/x86_64\n----------\nid: 3 or "Google Inc.:Google APIs:23"\n     Name: Google APIs\n     Type: Add-On\n     Vendor: Google Inc.\n     Revision: 1\n     Description: Android + Google APIs\n     Based on Android 6.0 (API level 23)\n     Libraries:\n      * com.android.future.usb.accessory (usb.jar)\n          API for USB Accessories\n      * com.google.android.media.effects (effects.jar)\n          Collection of video effects\n      * com.google.android.maps (maps.jar)\n          API for Google Maps\n     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320\n Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64\n',
  stderr: '',
  exitCode: 0 }
Available Android targets:
----------
id: 1 or "android-23"
     Name: Android 6.0
     Type: Platform
     API level: 23
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320
 Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 2 or "android-24"
     Name: Android 7.0
     Type: Platform
     API level: 24
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320
 Tag/ABIs : android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/arm64-v8a, default/armeabi-v7a, default/x86, default/x86_64
----------
id: 3 or "Google Inc.:Google APIs:23"
     Name: Google APIs
     Type: Add-On
     Vendor: Google Inc.
     Revision: 1
     Description: Android + Google APIs
     Based on Android 6.0 (API level 23)
     Libraries:
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.google.android.maps (maps.jar)
          API for Google Maps
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320, AndroidWearRound, AndroidWearRound360x360, AndroidWearRound400x400, AndroidWearRound480x480, AndroidWearRoundChin320x290, AndroidWearRoundChin320x300, AndroidWearRoundChin360x325, AndroidWearRoundChin360x326, AndroidWearRoundChin360x330, AndroidWearSquare, AndroidWearSquare240x240, AndroidWearSquare320x320
 Tag/ABIs : google_apis/armeabi-v7a, google_apis/x86, google_apis/x86_64

Directories found in D:\android-sdk\build-tools are 23.0.2, 23.0.3, 24.0.0, 24.0.2
Versions found in D:\android-sdk\build-tools are 23.0.2, 23.0.3, 24.0.0, 24.0.2
Selected version is:  23.0.3
Selected targetSdk is: 23
Directories found in D:\android-sdk\extras\android\m2repository\com\android\support\appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0-alpha1, 24.0.0-alpha2, 24.0.0-beta1, 24.1.0, 24.1.1, 24.2.0, maven-metadata.xml, maven-metadata.xml.md5, maven-metadata.xml.sha1
Versions found in D:\android-sdk\extras\android\m2repository\com\android\support\appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0, 24.0.0, 24.0.0, 24.1.0, 24.1.1, 24.2.0
Selected version is:  23.4.0
Selected AppCompat version is: 23.4.0
Project successfully prepared (android)
AfterHookName for command prepare is after-prepare
spawn: D:\git\holsa-app\platforms\android\gradlew.bat "buildapk" "-PcompileSdk=android-23" "-PtargetSdk=23" "-PbuildToolsVersion=23.0.3" "-PsupportVersion=23.4.0"

:config phase:  createDefaultIncludeFiles
        +found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
         Creating product flavors include.gradle file in D:\git\holsa-app\platforms\android/configurations folder...

:config phase:  pluginExtend
        +applying configuration from: D:\git\holsa-app\platforms\android\configurations\include.gradle
        +applying configuration from: D:\git\holsa-app\platforms\android\configurations\tns-core-modules-widgets\include.gradle

:config phase:  copyAarDependencies

:config phase:  addAarDependencies
        +adding dependency: D:\git\holsa-app\platforms\android\libs\aar\nativescript.aar
        +adding dependency: D:\git\holsa-app\platforms\android\libs\aar\widgets-release.aar
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preF0DebugBuild UP-TO-DATE
:checkF0DebugManifest
:preF0ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:prepareAppCompanyNameRuntimeUnspecifiedLibrary UP-TO-DATE
:prepareNativescriptLibrary UP-TO-DATE
:prepareWidgetsReleaseLibrary UP-TO-DATE
:prepareF0DebugDependencies
:compileF0DebugAidl UP-TO-DATE
:compileF0DebugRenderscript UP-TO-DATE
:generateF0DebugBuildConfig UP-TO-DATE
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:asbg:generateInterfaceNamesList
:asbg:runAstParser UP-TO-DATE
:asbg:generateBindings UP-TO-DATE
:mergeF0DebugShaders UP-TO-DATE
:compileF0DebugShaders UP-TO-DATE
:generateF0DebugAssets UP-TO-DATE
:mergeF0DebugAssets UP-TO-DATE
:generateF0DebugResValues UP-TO-DATE
:generateF0DebugResources UP-TO-DATE
:mergeF0DebugResources UP-TO-DATE
:processF0DebugManifest UP-TO-DATE
:processF0DebugResources UP-TO-DATE
:generateF0DebugSources UP-TO-DATE
:incrementalF0DebugJavaCompilationSafeguard UP-TO-DATE
:compileF0DebugJavaWithJavac UP-TO-DATE
:compileF0DebugNdk UP-TO-DATE
:compileF0DebugSources UP-TO-DATE
:buildMetadataException in thread "main" java.lang.IllegalArgumentException: Class com.tns.TypeIDs conflict: D:\git\holsa-app\platforms\android\build\intermediates\exploded-aar\nativescript\jars\classes.jar and D:\git\holsa-app\platforms\android\build\intermediates\exploded-aar\AppCompanyName\runtime\unspecified\jars\classes.jar
        at com.telerik.metadata.ClassRepo.cacheJarFile(ClassRepo.java:21)
        at com.telerik.metadata.Builder.build(Builder.java:39)
        at com.telerik.metadata.Generator.main(Generator.java:44)
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildMetadata'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 1

* 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: 17.428 secs
Error: Command D:\git\holsa-app\platforms\android\gradlew.bat failed with exit code 1
    at FiberFuture.Future.wait (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:566:15)
    at C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\lib\common\errors.js:128:33
    at Function.settle (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:249:26)
    at FiberFuture.Future.wait (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:565:10)
    at C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\lib\common\services\commands-service.js:84:106
    at Function.settle (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:249:26)
    at FiberFuture.Future.wait (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:565:10)
    at C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\lib\common\yok.js:208:124
    at Function.settle (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:249:26)
    at FiberFuture.Future.wait (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:565:10)
    at C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\lib\common\services\commands-service.js:51:55
    at Function.settle (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:249:26)
    at FiberFuture.Future.wait (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:565:10)
    at C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\lib\common\errors.js:128:33
    at Function.settle (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:249:26)
    at FiberFuture.Future.wait (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\node_modules\fibers\future.js:565:10)
    - - - - -
    at ChildProcess.<anonymous> (C:\Users\MyUserName\AppData\Roaming\npm\node_modules\nativescript\lib\common\child-process.js:91:38)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:829:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track feature 'Non-interactive' with value 'help'.
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, usage-reporting
Reading help for command 'build|android'. FileName is 'build-android.md'.
# build android
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Usage   โ”‚ Synopsis                                                                                                                                                                                                                             โ”‚
โ”‚ General โ”‚ $ tns build android [--compileSdk <API Level>] [--key-store-path <File Path> --key-store-password <Password> --key-store-alias <Name> --key-store-alias-password <Password>] [--release] [--static-bindings] [--copy-to <File Path>] โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Builds the project for Android and produces an APK that you can manually deploy on device or in the native emulator.

### Options

    * --compileSdk - Sets the Android SDK that will be used to build the project.
    * --release - If set, produces a release build. Otherwise, produces a debug build. When set, you must also specify the --key-store-* options.
    * --key-store-path - Specifies the file path to the keystore file (P12) which you want to use to code sign your APK. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-password - Provides the password for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias - Provides the alias for the keystore file specified with --key-store-path. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --key-store-alias-password - Provides the password for the alias specified with --key-store-alias-password. You can use the --key-store-* options along with --release to produce a signed release build. You need to specify all --key-store-* options.
    * --copy-to - Specifies the file path where the built .apk will be copied. If it points to a non-existent directory, it will be created. If the specified value is directory, the original file name will be used.

### Attributes
<API Level> is a valid Android API level. For example: 22, 23.

Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track exception with message 'Command D:\git\holsa-app\platforms\android\gradlew.bat failed with exit code 1'.
AnalyticsInstallationID: 3ff34634-399a-4aa1-98da-ed65577f3ec6
monitor not started
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
Analytics statuses:
{ TrackFeatureUsage: 1, TrackExceptions: 0 }
Trying to track feature 'NodeJSVersion' with value '4_5_0'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
bug

Most helpful comment

@cesarvega looks like you have a faulty archive of the gradle wrapper, it happens at times as a result of poor connection. Navigate to your %USER_HOME%.gradle/ and delete the wrapper/dists/gradle-2.10-bin directory to allow the wrapper to be redownloaded.

All 29 comments

Hi @progig,
The error you're seeing:

Class com.tns.TypeIDs conflict: 
build\intermediates\exploded-aar\nativescript\jars\classes.jar and
build\intermediates\exploded-aar\AppCompanyName\runtime\unspecified\jars\classes.jar

means you have two competing jars. Try searching for nativescript.jar and if you find it delete it and run the build again.

It would be really helpful if you to send us a way to reproduce your problem so we can help you. For future reference please follow the issue template we provided to help us help you.

Hi Plamen5kov,

Thanks for responding. I searched for nativescript.jar on my machine, but couldn't find it.

To reproduce the problem, upgrade nativescript from version 1.7 to 2.2.1 and try to (re)build an existing project with tns build android

I also tried to build the old version of sample-Groceries I had on disk, same problem occurred. After deleting it and cloning it again (newest version) , it built just fine.

Sorry @progig, I couldn't reproduce your problem. The steps I followed wre:

  • tns create oldapp (using cli 1.7.0)
  • cd oldapp
  • tns paltform add android (using cli 1.7.0)
  • tns build android (using cli 2.2.1)

I successfully reproduced your problem only when I forcefully moved the /platforms/android/libs/nativescript.jar into the new project template by doing:

  • tns create oldapp (using cli 1.7.0)
  • cd oldapp
  • tns paltform add android (using cli 2.2.1)
  • cp nativescript.jar ./platforms/android/ (nativescript jar came from the 1.7.0 template)
  • tns build android (using cli 2.2.1)

That means you have a nativescript.jar or classes.jar leftover in platforms/android or node_modules folder.

How you can try and fix this issue?

  • Try searching nativescript.jar inside of your projects folder and delete it.
  • Try to find which two jars contain: com.tns.TypeIDs class and remove the file not in /pltforms/android/ folder.
  • Provide us with a sample repo that reproduces the problem, so we can figure it out.

@Plamen5kov, thanks for taking the time to help me.

That means you have a nativescript.jar or classes.jar leftover in platforms/android or node_modules folder.

How can that be? I've removed both the platforms/android and node_modules folder with tns platform remove android and rm -Rf node_modules before building.

Try searching nativescript.jar inside of your projects folder and delete it.

I couldn't find such a file on my machine

Try to find which two jars contain: com.tns.TypeIDs class and remove the file not in /pltforms/android/ folder.

I tried to find that class in the jars in my project folder, but there's no such class in the jar files I found.

Provide us with a sample repo that reproduces the problem, so we can figure it out.

Please see the attachment for the repo
holsa-app.zip

@Plamen5kov
FYI and what it's worth: after building I see 2 different classes.jar files of different size:
/platforms/android/src/F0/widgets-release.aar size: 86.562 bytes
/platforms/android/libs/runtime-libs/nativescript.aar size: 86.424 bytes

@progig I was able to reproduce this erroneous behavior - as it turns out, you had the android runtime as both a platform, and a dependency of your project.

A simple way to fix this is to delete "tns-android": "^2.2.0" from your dependencies object in your package.json.

Make sure to delete both node_modules and the platforms dirs before running your app to remove any leftovers of the faulty module.

@Pip3r4o
Thanks! You made my day!
Still I wonder how "tns-android": "^2.2.0"ended up as a dependency object in my package.json.
I'm pretty sure I didn't put it there myself...

I have the same issue and deleting is not ficing it for me "nativescript": {
"id": "org.nativescript.HelloWorld",
"tns-android": {
"version": "2.5.0"
}

COMMAND RESULT

`C:\Users\cvega.BI\Desktop\@NGAndroid\HelloWorld>tns run android
Executing before-prepare hook from C:\Users\cvega.BI\Desktop\@NGAndroid\HelloWorld\hooks\before-prepare\nativescript-dev-android-snapshot.js
Preparing project...
Unzipping C:\Users\cvega.BI.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275\gradle-2.10-bin.zip to C:\Users\cvega.BI.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:159)
at org.gradle.wrapper.Install.access$500(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:69)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Processing node_modules failed. Error: Command C:\Users\cvega.BI\Desktop\@NGAndroid\HelloWorldplatforms\android\gradlew.bat failed with exit code 1
Sending exception report (press Ctrl+C to stop).....

C:\Users\cvega.BI\Desktop\@NGAndroid\HelloWorld>`

@cesarvega looks like you have a faulty archive of the gradle wrapper, it happens at times as a result of poor connection. Navigate to your %USER_HOME%.gradle/ and delete the wrapper/dists/gradle-2.10-bin directory to allow the wrapper to be redownloaded.

Thanks that fixed it

On Thu, Apr 20, 2017 at 3:09 PM, Peter Kanev notifications@github.com
wrote:

@cesarvega https://github.com/cesarvega looks like you have a faulty
archive of the gradle wrapper, it happens at times as a result of poor
connection. Navigate to your %USER_HOME%.gradle/ and delete the
wrapper/dists/gradle-2.10-bin directory to allow the wrapper to be
redownloaded.

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/NativeScript/android-runtime/issues/553#issuecomment-295862685,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwmodjphedy-3XEMKdqskiZ2QXKLrNJks5rx61YgaJpZM4J4B6y
.

--
Cesar Vega

Software Engineer

Where Great Brands Beginยฎ

http://www.brandinstitute.com/images/logo.jpg
http://www.brandinstitute.com/images/logo.jpg

@cesarvega had the same problem just now. Used the sdk 22 with nativescript 2.5.0. Did what @Pip3r4o said but had the same exact problem. No problems building for sdk 23.

@Dimitrievskislavcho What cesarvega described has little to do with the sdk used to build a project.

As for the gradle.bat exited with error code 1 - this is the generic message output whenever an android build fails.

tns run android
Executing before-prepare hook from C:\projet\hello-world\hooks\before-prepare\nativescript-dev-android-snapshot.js
Preparing project...
Unzipping C:\Users\Khouloud.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275\gradle-2.10-bin.zip to C:\Users\Khouloud.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:159)
at org.gradle.wrapper.Install.access$500(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:69)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Processing node_modules failed. Error: Command C:\projet\hello-worldplatforms\android\gradlew.bat failed with exit code 1
I have the same issue :(

@khalkhaloud I've already explained the fix above. Simply follow the steps and you are good to go.

@Pip3r4o i have delete "tns-android": "^2.2.0" from your dependencies object in my package.json But I have the same problem :(

ฮป tns run android
Executing before-prepare hook from C:\projet\hello-world\hooks\before-prepare\nativescript-dev-android-snapshot.js
Preparing project...
Unzipping C:\Users\Khouloud.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275\gradle-2.10-bin.zip to C:\Users\Khouloud.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:159)
at org.gradle.wrapper.Install.access$500(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:69)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Processing node_modules failed. Error: Command C:\projet\hello-worldplatforms\android\gradlew.bat failed with exit code 1

@Pip3r4o can you explain more please

@Pip3r4o
C:\prjt\Groceries
ฮป tns run android
Skipping prepare.
Searching for devices...
Starting Android emulator with image Nexus_5X_API_25
Waiting for emulator device initialization.......
Building project...
Downloading https://services.gradle.org/distributions/gradle-2.10-bin.zip
..........................................................................................................................................................................................................................................................................................
Unzipping C:\Users\Khouloud.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275\gradle-2.10-bin.zip to C:\Users\Khouloud.gradle\wrapper\dists\gradle-2.10-bin\baigpnfu14tdk6ztbfwcl8275
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:159)
at org.gradle.wrapper.Install.access$500(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:69)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Command C:\prjt\Groceriesplatforms\android\gradlew.bat failed with exit code 1
plz help me :(

@khalkhaloud I am repeating myself here, but there you go -> https://github.com/NativeScript/android-runtime/issues/553#issuecomment-295862685

looks like you have a faulty archive of the gradle wrapper, it happens at times as a result of poor connection. Navigate to your %USER_HOME%.gradle/ and delete the wrapper/dists/gradle-2.10-bin directory to allow the wrapper to be redownloaded.

i redownloaded the wrapper but nothing change !! the same error again

@khalkhaloud Unfortunately corrupted gradle wrapper archives is not something that we can fix, since we do not manage them - https://discuss.gradle.org/t/making-the-wrapper-more-resilient-to-corrupted-downloads/22066/4. Gradle are aware of these issues, and are working on resolving them.

Your best bet is to try to redownload the wrapper multiple times, or follow the gradle wrapper guidelines at https://docs.gradle.org/current/userguide/gradle_wrapper.html.

If you wish to, you could also install the release candidate version 3.0 tns platform add android@rc which distributes a different version of the gradle wrapper. We cannot guarantee however that the wrapper package will be valid.

I had the same issue and with gradle 3.3. Apparently, when I installed nativescript cli it wasn't downloaded properly. To fix the problem I removed entire folder .grandle in my USER_HOME directory and run the command 'tsn run' again. It downloaded new gradle and it works just fine now.

@Nogostradamus Yeah that works for me some times but sometimes it does not , I keep getting errors for no reason I delete the gradle but my app its mot working anymore this is so frustrating

      `* What went wrong:
      Execution failed for task ':mergeF0F1F2F3F4DebugResources'.
      > Error: Failed to crunch file C:\Users\cvega.BI\Desktop\@SIDEKICK\nativescript-marketplace-
        demo\platforms\android\build\intermediates\exploded-aar\com.google.android.gms\play-services-
         base\10.2.6\res\drawable-xxhdpi-
         v4\common_google_signin_btn_icon_light_normal_background.9.png into 
       C:\Users\cvega.BI\Desktop\@SIDEKICK\nativescript-marketplace-
       demo\platforms\android\build\intermediates\res\merged\F0F1F2F3F4\debug\drawable-xxhdpi-
       v4\common_google_signin_btn_icon_light_normal_background.9.png

     * Try:
     Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more 
     log output.
     Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit 
     code 1.`

@cesarvega we are in the process of updating the Gradle version, which supposedly has fixes for those problems you are facing. I'll let you know when they hit the master branch so you can test the changes!

Any ideas?

G:\Escritorio\nativescript\test-firebase\dist>tns run android
Searching for devices...
Skipping prepare.
Building project...
Gradle build...
         + setting applicationId
         + applying user-defined configuration from G:\Escritorio\nativescript\test-firebase\dist\app\App_Resources\Android\app.gradle
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: G:\Escritorio\nativescript\test-firebase\dist\node_modules\nativescript-plugin-firebase\platforms\android\firebase-release.aar
         + adding aar plugin dependency: G:\Escritorio\nativescript\test-firebase\dist\node_modules\nativescript-plugin-firebase-common\platforms\android\nativescript_plugin_firebase_common.aar
         + adding jar plugin dependency: G:\Escritorio\nativescript\test-firebase\dist\node_modules\nativescript-plugin-firebase-common\platforms\android\firebase-client-android-2.5.2.jar
         + adding aar plugin dependency: G:\Escritorio\nativescript\test-firebase\dist\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
C:\Users\globerada\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\a1f2d02a605d5a2aaa25afeb26781598\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\globerada\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\a1f2d02a605d5a2aaa25afeb26781598\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\globerada\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\a1f2d02a605d5a2aaa25afeb26781598\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

C:\Users\globerada\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\a1f2d02a605d5a2aaa25afeb26781598\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontStyle not found.

C:\Users\globerada\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\a1f2d02a605d5a2aaa25afeb26781598\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/font not found.

C:\Users\globerada\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\a1f2d02a605d5a2aaa25afeb26781598\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontWeight not found.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to process resources, see aapt output above for details.

* 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

BUILD FAILED in 3s
Unable to apply changes on device: 1018679f. Error is: Command gradlew.bat failed with exit code 1.

G:\Escritorio\nativescript\test-firebase\dist>

Same problem here.. I deleted all the gradle files in C:/%USER/.gradle but no solution..

+ applying user-defined configuration from C:\wamp\www\ns-vue-tabs-auth \dist\app\App_Resources\Android\app.gradle + add include.gradle from C:\wamp\www\ns-vue-tabs-auth\dist\node_module s\nativescript-background-http\platforms\android\include.gradle + add include.gradle from C:\wamp\www\ns-vue-tabs-auth\dist\node_module s\nativescript-camera\platforms\android\include.gradle + add include.gradle from C:\wamp\www\ns-vue-tabs-auth\dist\node_module s\nativescript-google-maps-sdk\platforms\android\include.gradle + applying plugin configuration from C:\wamp\www\ns-vue-tabs-auth\dist\ platforms\android\app\build\configurations\nativescript-background-http\include. gradle + applying plugin configuration from C:\wamp\www\ns-vue-tabs-auth\dist\ platforms\android\app\build\configurations\nativescript-camera\include.gradle + applying plugin configuration from C:\wamp\www\ns-vue-tabs-auth\dist\ platforms\android\app\build\configurations\nativescript-google-maps-sdk\include. gradle + adding nativescript runtime package dependency: nativescript-optimize d + adding aar plugin dependency: C:\wamp\www\ns-vue-tabs-auth\dist\node_ modules\nativescript-background-http\platforms\android\nativescript_background_h ttp.aar + adding aar plugin dependency: C:\wamp\www\ns-vue-tabs-auth\dist\node_ modules\nativescript-camera\platforms\android\nativescript_camera.aar + adding aar plugin dependency: C:\wamp\www\ns-vue-tabs-auth\dist\node_ modules\nativescript-google-maps-sdk\platforms\android\nativescript_google_maps_ sdk.aar + adding aar plugin dependency: C:\wamp\www\ns-vue-tabs-auth\dist\node_ modules\tns-core-modules-widgets\platforms\android\widgets-release.aar false Unable to apply changes on device: emulator-5554. Error is: Command gradlew.bat failed with exit code 1.

I'll remove the nativescript-google-maps-sdk plugin and try with the other one...

Hi @wa05 , I think I have found a solution, but I have to try more deeply.
Steps

1) npm run clean
2) template\app\App_Resources\Android\app.gradle


android {
  compileSdkVersion 26
  buildToolsVersion "26.0.0-beta2"
  defaultConfig {
    multiDexEnabled true
    generatedDensities = []
    applicationId = "XXX"
  }
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
} 

Being XXX whatever you have.
As you can see, I have added compileSdkVersion and buildToolsVersion. Also multiDexEnabled because with SDK a new error appears.
Try it!

I continue having the same error

I still have this issue. I can't build for android. I've tried all the solutions above. Any idea?

Was this page helpful?
0 / 5 - 0 ratings