function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ismail AkbulutIsmail Akbulut 

Error in eclipse - hybrid app for Android

Hello All,


I am followed the instructions of the Salesforce Touch Platform book that was handed out at Dreamforce in order to create a hybrid android application.

When I am import the ContactExplorer project eclipse complaint that SalesforceDroidGapActivity cannot be resolved. So I added salesforcesdk to my build path. However I am getting different errors:


- for Salesforcesdk ==> type org.apache.cordova.DroidDap cannot be resolved. In order to solve this I added cordova-1.8.1..Then I got following error message: R cannot be resolved to a variable    /ContactExplorer/src/com/salesforce/samples/contactexplorer    line 43    Java Problem.


Can anybody help?






I have a very similar problem for the andoird App template.


I've followed the instruction but had to manually add to the buildpath both the libraries android.jar and salesforce-1.3.1.jar this remove the import issues but causes the error:


R cannot be resolved to a variable 


If I try to instantiate R in SalesforceRImpl:


SalesforceRImpl R = this;


I obtain new errors:

- overrides com.salesforce.androidsdk.ui.SalesforceR.stringAccountType
- string cannot be resolved or is not a field
- R cannot be resolved to a variable


on lines like this one:

public int stringAccountType() { return R.string.account_type; }

Maurizio MobileMaurizio Mobile

HI Thomas,


Did you figure out how to solve this issue, I have the same.






Apparently I made a step forward, the code for the native android template app was created using these 2 libraries:




as of now, the latest cordova library is doing also the mobilegap functions with some exceptions.


If you want to use the template app (and cannot make git work) you should find the proper legacy version of both mobilegap and cordova libraries.


I tried to change the template and make it use only the latest cordova library alone, but it didn't work (some methods are no longer available)


I was just curious to make it work, probably the best shot is to find out how to make git resolve the libraries for you, please let me know if you can and which steps you did,


PS: there are other libraries to be manually resolved if you can't use git, but I was unable to work around those 2.




i got the same problem in eclipse by importing the sample hybrid Apps (ContactExplorer and VFConnector)


git://   !!!




i added:  -cordova-1.8.1




- for Salesforcesdk ==> type org.apache.cordova.DroidDap cannot be resolved.



R cannot be resolved to a variable  in    /ContactExplorer/src/com/salesforce/samples/contactexplorer 


Have anybody a solution to fix this problem??


thanks for help and kind regards




Try this: right click on the project -> import -> use File System (click next)
-> choose for example c:\SalesforceMobileSDK-Android\native\SalesforceSDK -> Select All ->
click finish. Before you do this, backup the AndriodManifest.xml.
After the import you past the backup AndriodManifest into your existing Manifest.

This steps has work for me




Hi Stephan:


I followed these steps. the R.Java file was not being generated and I was not able to run. Please suggest any remedies or files to be inclulded.







I have the same problem, too. Is there no solution?