0

I am very new to Cordova and tried to a sample application by following this guide: http://cordova.apache.org/docs/en/3.5.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

Unfortunately, I get the following error in the command-line:

            Running command: G:\CordovaTest\hello\platforms\android\cordova\build.bat 
            Buildfile: G:\CordovaTest\hello\platforms\android\build.xml

            -set-mode-check:

            -set-debug-files:

            -check-env:
             [checkenv] Android SDK Tools Revision 23.0.2
             [checkenv] Installed at D:\adt-bundle-windows-x86_64-20140702\sdk

            -setup:
                 [echo] Project Name: HelloWorld
              [gettype] Project Type: Application

            -set-debug-mode:

            -debug-obfuscation-check:

            -pre-build:

            -build-setup:
            [getbuildtools] Using latest Build Tools: 20.0.0
                 [echo] Resolving Build Target for HelloWorld...
            [gettarget] Project Target:   Android 4.4.2
            [gettarget] API level:        19
                 [echo] ----------
                 [echo] Creating output directories if needed...
                [mkdir] Created dir: G:\CordovaTest\hello\platforms\android\ant-build\rsObj
                [mkdir] Created dir: G:\CordovaTest\hello\platforms\android\ant-build\rsLibs
                 [echo] ----------
                 [echo] Resolving Dependencies for HelloWorld...
            [dependency] Library dependencies:
            [dependency] 
            [dependency] ------------------
            [dependency] Ordered libraries:
            [dependency] 
            [dependency] ------------------
                 [echo] ----------
                 [echo] Building Libraries with 'debug'...

            nodeps:

            -set-mode-check:

            -set-debug-files:

            -check-env:
             [checkenv] Android SDK Tools Revision 23.0.2
             [checkenv] Installed at D:\adt-bundle-windows-x86_64-20140702\sdk

            -setup:
                 [echo] Project Name: CordovaLib
              [gettype] Project Type: Android Library

            -set-debug-mode:

            -debug-obfuscation-check:

            -pre-build:

            -build-setup:
            [getbuildtools] Using latest Build Tools: 20.0.0
                 [echo] Resolving Build Target for CordovaLib...
            [gettarget] Project Target:   Android 4.4.2
            [gettarget] API level:        19
                 [echo] ----------
                 [echo] Creating output directories if needed...
                 [echo] ----------
                 [echo] Resolving Dependencies for CordovaLib...
            [dependency] Library dependencies:
            [dependency] No Libraries
            [dependency] 
            [dependency] ------------------

            -code-gen:
            [mergemanifest] Found Deleted Target File
            [mergemanifest] Merging AndroidManifest files into one.
            [mergemanifest] Manifest merger disabled. Using project manifest only.
                 [echo] Handling aidl files...
                 [aidl] No AIDL files to compile.
                 [echo] ----------
                 [echo] Handling RenderScript files...
                 [echo] ----------
                 [echo] Handling Resources...
                 [aapt] Found new input file
                 [aapt] Generating resource IDs...
                 [echo] ----------
                 [echo] Handling BuildConfig class...
            [buildconfig] No need to generate new BuildConfig.

            -pre-compile:

            -compile:
                 [echo] Creating library output jar file...

            -post-compile:

            -obfuscate:

            -dex:
                 [echo] Library project: do not convert bytecode...

            -crunch:
               [crunch] Crunching PNG Files in source dir: G:\CordovaTest\hello\platforms\android\CordovaLib\res
               [crunch] To destination dir: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\res
               [crunch] Crunched 0 PNG files to update cache

            -package-resources:
                 [echo] Library project: do not package resources...

            -package:
                 [echo] Library project: do not package apk...

            -post-package:

            -do-debug:
                 [echo] Library project: do not create apk...
            [propertyfile] Updating property file: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\build.prop
            [propertyfile] Updating property file: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\build.prop
            [propertyfile] Updating property file: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\build.prop
            [propertyfile] Updating property file: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\build.prop

            -post-build:

            debug:

            -code-gen:
            [mergemanifest] Found Deleted Target File
            [mergemanifest] Merging AndroidManifest files into one.
            [mergemanifest] Manifest merger disabled. Using project manifest only.
                 [echo] Handling aidl files...
                 [aidl] No AIDL files to compile.
                 [echo] ----------
                 [echo] Handling RenderScript files...
                 [echo] ----------
                 [echo] Handling Resources...
                 [aapt] Found Deleted Target File
                 [aapt] Generating resource IDs...
                 [echo] ----------
                 [echo] Handling BuildConfig class...
            [buildconfig] Generating BuildConfig class.

            -pre-compile:
                 [echo] Set jars path to: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\classes.jar

            -compile:
                [javac] Compiling 3 source files to G:\CordovaTest\hello\platforms\android\ant-build\classes

            -post-compile:

            -obfuscate:

            -dex:
                  [dex] input: G:\CordovaTest\hello\platforms\android\ant-build\classes
                  [dex] input: G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\classes.jar
                  [dex] Pre-Dexing G:\CordovaTest\hello\platforms\android\CordovaLib\ant-build\classes.jar -> classes-c7d3e986ff339bb9d7b4b67df549a8b8.jar
                   [dx] 
                   [dx] trouble writing output: java.security.NoSuchAlgorithmException: SHA-1 MessageDigest not available

            BUILD FAILED
            D:\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:892: The following error occurred whil
            e executing this line:
            D:\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:894: The following error occurred whil
            e executing this line:
            D:\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:906: The following error occurred whil
            e executing this line:
            D:\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:283: null returned: 2

            Total time: 10 seconds
            Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,G:\CordovaTest\hello\platforms\android\b
            uild.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
            Command finished with error code 2: G:\CordovaTest\hello\platforms\android\cordova\build.bat
            Error: G:\CordovaTest\hello\platforms\android\cordova\build.bat: Command failed with exit code 2
                at ChildProcess.whenDone (C:\Users\IBM_ADMIN\AppData\Roaming\npm\node_modules\cordova\node_modul
            es\cordova-lib\src\cordova\superspawn.js:135:23)
                at ChildProcess.EventEmitter.emit (events.js:98:17)
                at maybeClose (child_process.js:743:16)
                at Process.ChildProcess._handle.onexit (child_process.js:810:5)

I use windows7 64bit. My env variables are as bellow!

            D:\SDK7_64\bin;D:\SDK7_64\jre\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows
            \System32\WindowsPowerShell\v1.0\;C:\Program Files\IBM\Infoprint Select;C:\Program Files\ThinkPad\Bl
            uetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files\Intel\WiFi\
            bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Lenovo\Access Connec
            tions\;C:\Program Files (x86)\IBM\Personal Communications\;C:\Program Files (x86)\IBM\Trace Facility
            \;D:\Program Files\IDM Computer Solutions\UltraEdit-32;D:\Program Files\nodejs\;D:\Program Files\Clo
            udFoundry;D:\Program Files\cURL\bin;D:\jq;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common F
            iles\Intel\WirelessCommon\;D:\Program Files\SSH Communications Security\SSH Secure Shell;C:\Users\IB
            M_ADMIN\AppData\Roaming\npm;D:\apache-ant-1.9.4\bin;D:\AndroidSDK\sdk\platform-tools;D:\AndroidSDK\s
            dk\tools

Can anyone help me on this ? Thank you very much!

PKlumpp
  • 4,913
  • 8
  • 36
  • 64

1 Answers1

0

Do you have ever read the build output you copied into your question?

It contains near the end where error messages are usually output:

[dx] trouble writing output: java.security.NoSuchAlgorithmException: SHA-1 MessageDigest not available

BUILD FAILED

This is the error message to investigate for the reason of the failed build.

Next I run a search with "SHA-1 MessageDigest not available" and found on Stack Overflow:

And more webpages containing this error message string can be found with using a WWW search engine.

This error message can have several different reasons as I know now after reading the answers and some other webpages. You have to find out by yourself which one of those reasons is responsible for the error message on your build.

Community
  • 1
  • 1
Mofi
  • 46,139
  • 17
  • 80
  • 143