1

I have been struggling for a couple of days creating an hybrid app with salesforce mobile sdk. I managed to execute some samples app in by cloning the saleseforce mobile sdk git repo and following these instructions: https://github.com/forcedotcom/SalesforceMobileSDK-Android/blob/master/hybrid/README.md.

I wanted to create a new app from scratch cause I need to import some plugins, I couldn't do it with the sample projects (cordova says they are not valid cordova project directories).

I followed several guides: http://paste.scsys.co.uk/465779

and other variants.... (I didn't save all the links)

I always receive that error when I build the project:

    Running command: C:\Users\giovi\Desktop\testApp\TestApp\platforms\android\cordov
a\build.bat
Buildfile: C:\Users\giovi\Desktop\testApp\TestApp\platforms\android\build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 24.0.2
 [checkenv] Installed at C:\Users\giovi\AppData\Local\Android\android-sdk

-setup:
     [echo] Project Name: com.plugin.gcm.PushHandlerActivity
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

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

BUILD FAILED
C:\Users\giovi\AppData\Local\Android\android-sdk\tools\ant\build.xml:577: ../../
external/cordova/framework resolve to a path with no project.properties file for
 project C:\Users\giovi\Desktop\testApp\TestApp\plugins\com.salesforce\src\andro
id\libs\SalesforceSDK

Total time: 0 seconds

C:\Users\giovi\Desktop\testApp\TestApp\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:\Users\giovi\Deskt
op\testApp\TestApp\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolut
e.dir=ant-gen
ERROR building one of the platforms: Error: C:\Users\giovi\Desktop\testApp\TestA
pp\platforms\android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project

I don't think it's a problem related with my environment because if a I try to create a cordova project without the salesforce Mobile Sdk plugins, the compilation step works as expected.

I've tried several options and I don't know what to do know, could anyone help me?

Thanks

closed as off-topic by Eric, Boris Bachovski, Adrian Larson, Vamsi Krishna, crmprogdev Sep 23 '15 at 18:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions not specific to Salesforce are off-topic here, but can be asked on Stack Overflow." – Eric, Boris Bachovski, Adrian Larson, Vamsi Krishna, crmprogdev
If this question can be reworded to fit the rules in the help center, please edit the question.

0

This would happen in a few cases

A) You do not have a clean build. Run the following commands in your app folder (assuming you have added android platform with cordova)

cd platforms/android
ant clean
cd ../../
cordova build android

B) Make sure the sdk.dir variable in your project.properties is pointing to the correct location

C) The value of android.library.reference.1 parameter is not set correctly

D) check that your config.xml has these tags

<platform name="ios">
</platform>
<platform name="android">
</platform>

This seems a known issue with recent Cordova version

  • Hi Gaurav and thanks for the reply! I ran the "ant clean" command you told me but I got a "build failure with that error BUILD FAILED C:\Users\giovi\AppData\Local\Android\android-sdk\tools\ant\build.xml:459: ../../ external/cordova/framework resolve to a path with no project.properties file for project C:\Users\giovi\Desktop\myApp\myapp\plugins\com.salesforce\src\android\l ibs\SalesforceSDK – Giovanni Di Santo Feb 24 '15 at 14:55
  • my project.properties is set like this: target=android-21 android.library.reference.1=CordovaLib manifestmerger.enabled=true android.library.reference.2=..\\..\\plugins\\com.salesforce\\src\\android\\libs\\SmartSync You can see that android.library.reference.1 points to CordovaLIb, a folder that does exist in my project. sdk.dir seems to point to the correct folder. There must be something I'm missing but I don't understand what... – Giovanni Di Santo Feb 24 '15 at 15:02
  • can you confirm your sdk and cordova versions? – Gaurav Kheterpal Feb 24 '15 at 16:08
  • Updated my answer, verify point d) – Gaurav Kheterpal Feb 24 '15 at 16:14
  • Thanks for your helping! Unfortunately the last trick didn't solve the problem. I guess the problem is related to the salesforce mobile sdk plugin cause I'm able to build cordova project without it. My cordova version is 4.2.0 This is my current sdk situation: drive.google.com/file/d/0B6C_87COhuKiRkFNeWh2eGtqLUk/… drive.google.com/file/d/0B6C_87COhuKiNGFXMk1DS0poY3M/… drive.google.com/file/d/0B6C_87COhuKiN05VNnlGeGhKdHc/… I hope this information could better clarify my problem Thanks – Giovanni Di Santo Feb 24 '15 at 22:16
0

Unfortunately, there's a known issue with 'cordova build'. You should be able to build your project using eclipse though.

  • It didn't work for me. Please check the workaround I used to build the apk. – Giovanni Di Santo Feb 27 '15 at 23:15
0

Eventually I managed to compile my project. I installed a fresh Linux environment (ubuntu 14.10) using a virtual machine. In this new system I configured all the dependencies: java, jdk, git, ant, adt... I can now build a cordova project using the salesforce mobile sdk by following these steps (different from the ones provided in the user guide):

1)cordova create test com.company.test test

2)cd test

3)cordova platform add android

4)cordova build (without this first build it won't compile after)

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

6)add bootconfig.json file properly configured

7)cordova build

8)cordova run

Not the answer you're looking for? Browse other questions tagged or ask your own question.