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

Facing issues while updating salesforce mobile SDK from 10 to 12 #2572

Closed
hemantsumanmetacube opened this issue May 23, 2024 · 6 comments
Closed

Comments

@hemantsumanmetacube
Copy link

We are trying to update Salesforce Mobile SDK from 10.2 to 12.1, So we created a new project using forcehybrid create command, We identified that the SDK dependencies like SalesforceSDk, SmartStore, SalesforceHybrid etc. are included as a composite gradle module in the new project.
̇We have our custom local changes in Salesforce Mobile SDK files and also we have created a cordova plugin which is directly importing SDK libraries.
Now the imports are broken in our custom plugin and changes we are doing inside the root directory/plugins.com.salesforce are not reflecting.
Screenshot 2024-05-23 at 4 08 36 PM

Please provide a solution so we can safely upgrade MobileSDK.
Thanks

@wmathurin
Copy link
Contributor

Before 11.1, generated hybrid apps always got MSDK from sources (bundled in the MSDK cordova plugin) at ./plugins/com.salesforce/src/android/

Since 11.1, generated hybrid apps get MSDK from Maven Central in production (tagged version) and from sources in pre-release (dev branch). However when getting them from sources, they are expected from a different location ./platforms/android/mobile_sdk where the MSDK is being checked out at application generation time.

In your case I recommend you check our the MSDK in the ./platforms/android/mobile_sdk location by doing

git clone --tag  v12.0.1 --single-branch --depth 1 https://github.com/forcedotcom/SalesforceMobileSDK-Android  ./platforms/android/mobile_sdk

Then apply your changes

Then the exiting code in settings.gradle will ensure it gets picked up

include ":app"
def salesforceMobileSdkRoot = new File('mobile_sdk/SalesforceMobileSDK-Android');
if (salesforceMobileSdkRoot.exists()) {
  includeBuild(salesforceMobileSdkRoot)
}

On our side, we will clean SalesforceMobileSDK-CordovaPlugin so that it no longer embeds source files from SalesforceMobileSDK-Android since they are never used.

@hemantsumanmetacube
Copy link
Author

hemantsumanmetacube commented May 30, 2024

After making the changes you suggested, drawable resources related to salesforce sdk are not being found.
Also getting the error when impoerting the salesforce -

error: package com.salesforce.androidsdk.accounts does not exist
import com.salesforce.androidsdk.accounts.UserAccount;

@wmathurin
Copy link
Contributor

So you have a clone of your SalesforceMobileSDK-Android fork in a folder mobile_sdk ? From Android Studio, you can tell it's picking the code from there ? Did you gradle sync and then did a clean rebuild ?

@hemantsumanmetacube
Copy link
Author

hemantsumanmetacube commented Jun 7, 2024

Yes, I did a gradle sync and clean rebuild, it is still giving this error.
Below is the project structure we are getting.
Pasted Graphic

@wmathurin
Copy link
Contributor

You settings.gradle points to your correct folder?
The following

def salesforceMobileSdkRoot = new File('mobile_sdk/SalesforceMobileSDK-Android');

expects a SalesforceMobileSDK-Android clone as a sub-directory of the mobile_sdk directory.

@brandonpage
Copy link
Contributor

Closing due to a lack of activity.

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

3 participants