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

Salesforce SDK not compiling for version 11.1.0 due to plugin error. #2512

Closed
adriduttaheb opened this issue Feb 13, 2024 · 4 comments
Closed

Comments

@adriduttaheb
Copy link

adriduttaheb commented Feb 13, 2024

Please fill out the following details:

  1. Version of Mobile SDK Used: 11.1.0
  2. Issue found in Native App or Hybrid App: Native App
  3. OS Version: 14
  4. Device: Samsung / Pixel
  5. Steps to reproduce: Building native project with the sdk
  6. Actual behavior: Build does not compile
  7. Expected Behavior: Build Compiles
  8. Error Log: partnernet-android/SalesforceMobileSDK-Android/libs/SalesforceSDK/build.gradle.kts:8:5: Unresolved reference: android-library

In the SalesforceMobileSDK-Android/libs folder, most of the library gradle files have these plugins, which caused the above error

plugins {
    `android-library`
    `kotlin-android`
    `publish-module`
}

I changed them to the below syntax in our modified sdk and it started working correctly. However, "publish-module" wasn't able to be found, so I removed it, and it still seemed to work. I was wondering what purpose was of publish-module and if it can have any side effects.

plugins {
    id("android-library")
    id("kotlin-android")
}
@JohnsonEricAtSalesforce
Copy link
Contributor

@adriduttaheb - Thanks for your post and I'll see if I can provide more insight.

If the Gradle workspace for the app is still using include instead of includeBuild to compile the Salesforce libraries from source, that's probably the root cause of the error you reported. Prior to 11.1, Salesforce Mobile SDK templates would use Gradle's per-module include directive to add the MSDK modules to the app's Gradle workspace.

In 11.1, the Gradle workspace for Salesforce Mobile SDK was upgraded. To build the libraries from source in an app's Gradle workspace, a Gradle composite build should be used. That uses Gradle's includeBuild directive. The error you reported happens since each library module now has dependencies on the Gradle workspace that contains them. Using a composite build brings that all together in the app's Gradle workspace as well. The latest versions of the the template apps have reference code for this. Here's a screenshot of the relevant diff that shows the key changes in one of the template apps.

Screenshot 2024-02-13 at 11 25 23

That said, if you can build the app with the changes you listed above I suspect all is well. Read on though, since I also have another idea for your app 👇🏻

Unless your app includes some local changes to the Salesforce Mobile SDK library sources, there's another new option that might really speed up your builds. The Salesforce Mobile SDK libraries are hosted, pre-compiled, in Maven Central. You can switch to those by removing the include/includeBuild references to the Salesforce Mobile SDK sources plus adding the 11.1.0 version number to all your dependencies entries for Salesforce Mobile SDK libraries. Then, the local source directories for Salesforce Mobile SDK can also be removed.

Let me know if all this helps and if you have questions I can answer.

@adriduttaheb
Copy link
Author

Yes, we had to modify the sdk for our needs, so we can't get the precompiled version, but thank you for the quick response!

@wmathurin
Copy link
Contributor

Could you try again with Mobile SDK 12.0 that was just released?

@wmathurin
Copy link
Contributor

Closing - please re-open if Eric's recommendation earlier was not helpful.

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