android: Build error: gradlew.bat failed with exit code 1
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: <path-to-my-project>/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_modulesfolder - Updating the Andoid SDK
gradlew cleanin 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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 29 (10 by maintainers)
@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-bindirectory to allow the wrapper to be redownloaded.@progig I was able to reproduce this erroneous behavior - as it turns out, you had the
android runtimeas both a platform, and a dependency of your project.A simple way to fix this is to delete
"tns-android": "^2.2.0"from yourdependenciesobject in yourpackage.json.Make sure to delete both
node_modulesand theplatformsdirs before running your app to remove any leftovers of the faulty module.i redownloaded the wrapper but nothing change !! the same error again
@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 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.<init>(ZipFile.java:219) at java.util.zip.ZipFile.<init>(ZipFile.java:149) at java.util.zip.ZipFile.<init>(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\HelloWorld\platforms\android\gradlew.bat failed with exit code 1 Sending exception report (press Ctrl+C to stop)…
C:\Users\cvega.BI\Desktop@NGAndroid\HelloWorld>`