forcedotcom / SalesforceMobileSDK-Android

Android SDK for Salesforce
Other
341 stars 388 forks source link

SDK init issue with. ClassNotFoundException: ***.BuildConfig #2511

Closed mig35 closed 8 months ago

mig35 commented 9 months ago

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

  3. OS Version: any version

  4. Device: any device

  5. Steps to reproduce: Init SalesforceSDKManager from application class that is located not in the root directory of the project.

  6. Actual behavior: SDK is not able to get BuildConfig value correctly

  7. Expected Behavior: SDK should be able to init correctly and use context.packageName, but not context.getClass().getPackage().getName()

  8. Error Log:

    getBuildConfigValue failed
    java.lang.ClassNotFoundException: OUR_PACKAGE_NAME.android.app.BuildConfig
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:536)
    at java.lang.Class.forName(Class.java:467)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.getBuildConfigValue(SalesforceSDKManager.java:1611)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.isDebugBuild(SalesforceSDKManager.java:1600)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.isDevSupportEnabled(SalesforceSDKManager.java:1488)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.setupDeveloperSupport(SalesforceSDKManager.java:998)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.initInternal(SalesforceSDKManager.java:436)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.init(SalesforceSDKManager.java:410)
    at com.salesforce.androidsdk.app.SalesforceSDKManager.initNative(SalesforceSDKManager.java:447)
    at com.getsquire.commander.data.support.salesforce.SalesforceManager.<init>(SalesforceManager.kt:49)
    at OUR_PACKAGE_NAME.android.app.di.providers.SupportManagerProvider.get(SupportManagerProvider.kt:20)
    at OUR_PACKAGE_NAME.android.app.di.providers.SupportManagerProvider.get(SupportManagerProvider.kt:12)
    at toothpick.InternalProvider.get(InternalProvider.java:168)
    at toothpick.InternalScopedProvider.get(InternalScopedProvider.java:80)
    at toothpick.ScopeImpl.getInstance(ScopeImpl.java:93)
    at toothpick.ScopeImpl.getInstance(ScopeImpl.java:84)
    at OUR_PACKAGE_NAME.android.app.OUR_APP_CLASS.initSupportManager(CommanderApp.kt:206)
    at OUR_PACKAGE_NAME.android.app.OUR_APP_CLASS.onCreate(CommanderApp.kt:97)
JohnsonEricAtSalesforce commented 9 months ago

@mig35 - I was able to confirm this is a bug today in MSDK 11.1.0. Thanks for your detailed report and suggestions. We ought to be able to include this fix in 12.0.0, the next release. Is your app able to work-around this for now by keeping the application class in the default package?

mig35 commented 9 months ago

hey @JohnsonEricAtSalesforce thank you for your response. we were able to work around this. anyway do you have any timeline for the 12.0.0 release?

JohnsonEricAtSalesforce commented 9 months ago

That's great to hear. 12.0.0 doesn't have an exact release date on the calendar, but it is currently in progress and should be available in approximately a month. The fix is in https://github.com/forcedotcom/SalesforceMobileSDK-Android/pull/2513

brandonpage commented 8 months ago

As previously stated, fixed in #2513