Closed hemantsumanmetacube closed 1 month ago
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.
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;
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 ?
Yes, I did a gradle sync and clean rebuild, it is still giving this error. Below is the project structure we are getting.
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.
Closing due to a lack of activity.
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.
Please provide a solution so we can safely upgrade MobileSDK. Thanks