Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUILD FAILED: Exit code 1 #56

Closed
annoyingmouse opened this issue Mar 6, 2015 · 18 comments
Closed

BUILD FAILED: Exit code 1 #56

annoyingmouse opened this issue Mar 6, 2015 · 18 comments

Comments

@annoyingmouse
Copy link

We're trying to get this working at the minute and have followed the instructions here. Everything works fine until we get to the line:

cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin

At which point we get the following error:

BUILD FAILED
C:\Users\<USER>\AppData\Local\Android\android-sdk\tools\ant\build.xml:577: ../../external/cordova/framework resolve to a path with n
o project.properties file for project C:\DATA\WIP\REPOS\Test\contact-force\plugins\com.salesforce\src\android\libs\SalesforceSDK

Total time: 0 seconds

C:\DATA\WIP\REPOS\Test\contact-force\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                            ^
Error code 1 for command: cmd with args: /s /c "ant debug -f C:\DATA\WIP\REPOS\Test\contact-force\platforms\android\build.xml -Dout.dir=ant
-build -Dgen.absolute.dir=ant-gen"
ERROR building one of the platforms: Error: C:\DATA\WIP\REPOS\Test\contact-force\platforms\android\cordova\build.bat: Command failed with e
xit code 1
You may not have the required environment or OS to build this project
Error: C:\DATA\WIP\REPOS\Test\contact-force\platforms\android\cordova\build.bat: Command failed with exit code 1
    at ChildProcess.whenDone (C:\Users\<USER>\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspa
wn.js:131:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1008:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1080:5)

Apologies for using the Royal "we" it's just that my colleague is doing exactly the same and having the same issues. We trying to develop a hybrid Android Application and of course are adapting the instructions for use android rather than ios. We've got ant and the android sdk installed correctly as when we run cordova build after each step everything works fine, it's only after adding the SalesforceMobileSDK-CordovaPlugin that we get build errors.

We get the same errors when following the instructions in the PDF as well.

@xuzongque
Copy link

Glad to see other friends here.

First please check whether or not you have the right API level installed, according to the AndroidManifest.xml the plugin targets API Level 21. If API Level 21 is already installed, try also install all levels start from 17.

If you are sure that android SDK is installed correctly, there could be a build path issue in the plugin as I also encountered it when I started my app, there is a workaround:
After install the plugin, go to [project path]/plugins/com.salesforce/src/android/libs/, then go inside each of 3 folders under it and hit ant debug, after that cordova project could be built without error.

Hope this message can help.

@annoyingmouse
Copy link
Author

Hi Xu,

thanks for the input. I ran ant debug where you suggested and had issues with ANDROID_HOME not being set correctly. It seems as though I am unable to get the SF plugin to clock that ANDROID_HOME is where I put it.

I can echo %ANDROID_HOME% and it knows where it is supposed to be but it isn't reflected in the output as it still looks where it thinks it should be rather than where it actually is. This is helpful though as I think it might explain where everything else is going wrong - except now I'm getting an this error after moving my Android SDK to where the plugin thinks it should be:

BUILD FAILED
C:\Users\<USER>\AppData\Local\Android\android-sdk\tools\ant\build.xml:577: ../../external/cordova/framework resolve to a path with no project.properties file for project D:\wip\SFSDK\inspections\plugins\com.salesforce\src\android\libs\SalesforceSDK

Total time: 0 seconds

@xuzongque
Copy link

Try the following:(assume android tools folder is inside your path, otherwise you may find the "android" executable under [android SDK]/tools)

  1. in command line hit android list target, note the printed out id number for platform API 21.
  2. Go to [app project path]/plugins/com.salesforce/src/android/libs/SalesforceSDK, hit android update project -p . -t <id>, where <id> is the number you noted in last step
  3. Try ant debug now

Do the same steps also for SmartStore and SmartSync.

@annoyingmouse
Copy link
Author

Hi again Xu and thanks for your assistance.

I'm afraid that it failed at the first hurdle with this message:

-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
     [echo] Resolving Build Target for SalesforceSDK...
[gettarget] Project Target:   Android 5.0.1
[gettarget] API level:        21
     [echo] ----------
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Resolving Dependencies for SalesforceSDK...

BUILD FAILED
D:\Android\android-sdk\tools\ant\build.xml:577: ../../external/cordova/framework
 resolve to a path with no project.properties file for project d:\wip\SFSDK\inspections\plugins\com.salesforce\src\android\libs\SalesforceSDK

This was after getting this:

----------
id: 5 or "android-21"
     Name: Android 5.0.1
     Type: Platform
     API level: 21
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in, AndroidWearRound, AndroidWearSquare, AndroidWearRound, AndroidWearSquare
 Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, android-wear/armeabi-v7a, android-wear/x86, default/armeabi-v7a, default/x86, default/x86_64

And doing both this:

D:\Android\android-sdk\tools\android.bat update project -p . -t "android-21"

And this:

D:\Android\android-sdk\tools\android.bat update project -p . -t 5

Whatever I set the update to be (either 5 or "android-21") I get the error noted above.

Thanks for your time,

Dom

@xuzongque
Copy link

The idea here is to let ant know where android sdk and where dependent libraries are.
SalesforceSDK depends on Cordova lib.
SmartStore depends on SalesforceSDK.
SmartSync depends on SmartStore.
But for some reason the build paths are not resolved correctly in your pc.
Maybe you could check the output after you do android.bat update project -p . -t <id>, are there any errors?
Here is mine: (my id is 35)
screen shot 2015-03-09 at 13 51 54

Here is my project.properties for SalesforceSDK:(after project update)

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=Google Inc.:Google APIs:21
android.library=true
android.library.reference.1=../../../../../../platforms/android/CordovaLib
android.library.reference.2=../../../../../../platforms/android/CordovaLib

It points to the platform directory of the same app project where resides the cordova library.

The local.properties contains the path to android SDK:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Users/zongquexu/Tools/adt-bundle-mac-x86_64-20140702/sdk

proguard-project.txt contains nothing but comments.

May be there are differences between Windows and Mac but the idea should be the same.

@annoyingmouse
Copy link
Author

Hi Xu,

D:\wip\SFSDK\inspections\plugins\com.salesforce\src\android\libs\SalesforceSDK>D:\Android\android-sdk\tools\android.bat update project -p . -t 5
Updated project.properties
Updated local.properties
Updated file D:\wip\SFSDK\inspections\plugins\com.salesforce\src\android\libs\SalesforceSDK\proguard-project.txt

produces (project.properties):

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-21
android.library=true
android.library.reference.1=../../external/cordova/framework
android.library.reference.2=..\\..\\..\\..\\..\\..\\platforms\\android\\CordovaLib

And (local.properties)

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=d:\\Android\\android-sdk

And (proguard-project.txt)

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

Does that help?

@xuzongque
Copy link

In project.properties Try to modify line:
android.library.reference.1=../../external/cordova/framework
into:
android.library.reference.1=..\\..\\..\\..\\..\\..\\platforms\\android\\CordovaLib

@wheresmythribble
Copy link

Did anyone ever get this to work? This looks like it's the same issue I am having - trying to use SalesForce SDK to create an Android hybrid on Windows.

@michacom
Copy link

@bhariharan, would you like to post the exact versions of ant, jdk, node and cordova you use?

@vdyalex
Copy link

vdyalex commented Jul 31, 2015

@michacom I already have experienced this bug using both the forcedroid and cordova plugin. I tried all solutions which @xuzongque kindly have proposed.

I believe these problems are occurring only with Windows. I'm trying on a Mac OS X also.

My versions of Windows are:

C:\>ant -v
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
Trying the default build file: build.xml
Buildfile: build.xml does not exist!
Build failed

C:\>java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

C:\>node -v
v0.12.2

C:\>cordova -v
5.1.1

Thanks for attention helping us.

Kind regards.

@vdyalex
Copy link

vdyalex commented Aug 5, 2015

@annoyingmouse, try to downgrade the version of Cordova. It works to me.

npm uninstall -g cordova && npm install -g cordova@4.3.0 

@annoyingmouse
Copy link
Author

Thank @alexndreazevedo , the next time I need something using the SalesforceMobileSDK-CordovaPlugin I'll make sure I do so. ;-)

@wmathurin
Copy link
Contributor

We have added the max version constraint in the plugin.xml.
See:
487941c

@DiegoBuenoCoelho-zz
Copy link

I cannot do anything with these command lines.. oh my god..
That's frustating

@vdyalex
Copy link

vdyalex commented Sep 23, 2015

@DieguitoBueno do you have tried remove and add again the android platform. When you downgrade the Cordova NPM, it doesn't change nothing into your project. I only could have success when I cleaned my platforms.

@Suchitkushwaha
Copy link

delete the platforms and add the platforms again using ionic platform add android its works for me :-)

@FauzyAbdan
Copy link

can you build for another cordova project?
If it is yes, you must match configuration on "build.xml" line 577 with your "config.xml".
In my case the problems were "uses-permission" and "access origin" in my "config.xml".

@gtzinos
Copy link

gtzinos commented Sep 30, 2016

Here is the solution guys !!! https://stackoverflow.com/questions/36095819/cordova-ios-error-building-images-xcassets/36968113#36968113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants