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

getBuildConfigValue failed #2606

Open
johnjeremih opened this issue Aug 26, 2024 · 1 comment
Open

getBuildConfigValue failed #2606

johnjeremih opened this issue Aug 26, 2024 · 1 comment

Comments

@johnjeremih
Copy link

Please fill out the following details:

  1. Version of Mobile SDK Used: 12.0.0
  2. Issue found in Native App or Hybrid App: Native
  3. OS Version: 34
  4. Device: Pixel 6a
  5. Steps to reproduce: I have target sdk 34 and gradle version 8.3.0
  6. Actual behavior:
  7. Expected Behavior:
  8. Error Log:
    getBuildConfigValue failed (Ask Gemini) java.lang.ClassNotFoundException: com.myapp.nativeandroid.dev.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.kt:1356) at com.salesforce.androidsdk.app.SalesforceSDKManager.isDebugBuild(SalesforceSDKManager.kt:1338) at com.salesforce.androidsdk.app.SalesforceSDKManager.isDevSupportEnabled(SalesforceSDKManager.kt:440) at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.setupDeveloperSupport(SalesforceSDKManager.kt:1635) at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.initInternal(SalesforceSDKManager.kt:1556) at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.init(SalesforceSDKManager.kt:1525) at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.init$default(SalesforceSDKManager.kt:1511) at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.initNative(SalesforceSDKManager.kt:1589) at com.myapp.nativeandroid.MyAppApplication.onCreate(MyAppApplication.kt:25) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6998) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.nativeandroid.dev.BuildConfig" on path: DexPathList[[dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes17.dex", dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes30.dex", dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes14.dex", dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes10.dex", dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes15.dex", dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes4.dex", dex file "/data/data/com.myapp.nativeandroid.dev/code_cache/.overlay/base.apk/classes19.dex", zip file "/data/app/~~mZPx7yWkw657t5cBQ0QqaQ==/com.myapp.nativeandroid.dev-EdJYVKDpJc1cJgGSuedhqg==/base.apk"],nativeLibraryDirectories=[/data/app/~~mZPx7yWkw657t5cBQ0QqaQ==/com.myapp.nativeandroid.dev-EdJYVKDpJc1cJgGSuedhqg==/lib/arm64, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) 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.kt:1356)  at com.salesforce.androidsdk.app.SalesforceSDKManager.isDebugBuild(SalesforceSDKManager.kt:1338)  at com.salesforce.androidsdk.app.SalesforceSDKManager.isDevSupportEnabled(SalesforceSDKManager.kt:440)  at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.setupDeveloperSupport(SalesforceSDKManager.kt:1635)  at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.initInternal(SalesforceSDKManager.kt:1556)  at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.init(SalesforceSDKManager.kt:1525)  at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.init$default(SalesforceSDKManager.kt:1511)  at com.salesforce.androidsdk.app.SalesforceSDKManager$Companion.initNative(SalesforceSDKManager.kt:1589)  at com.myapp.nativeandroid.MyAppApplication.onCreate(MyAppApplication.kt:25)  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6998)  at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2236)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loopOnce(Looper.java:205)  at android.os.Looper.loop(Looper.java:294)  at android.app.ActivityThread.main(ActivityThread.java:8177)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) 
@forcedotcom forcedotcom deleted a comment Aug 26, 2024
@Techfhil
Copy link

Techfhil commented Oct 2, 2024

To resolve the getBuildConfigValue failed issue, I recommend the following steps:

Verify Build Configuration: Ensure your build.gradle file contains the correct application ID and that there are no misconfigurations. Double-check that the applicationId matches the package name where the BuildConfig class is expected.

Clean and Rebuild: Execute a clean build of your project to regenerate the necessary files. You can do this by running:

./gradlew clean assembleDebug
This will help ensure that the BuildConfig class is properly generated.

Check Package Structure: Confirm that the BuildConfig class is being generated in the correct package. You can do this by inspecting the APK or build output directory to ensure it exists at com.myapp.nativeandroid.dev.BuildConfig.

Gradle Sync Issues: Sometimes, Gradle sync problems can lead to missing classes. Make sure that all dependencies are correctly included and that there are no conflicts. Try invalidating caches in Android Studio (File -> Invalidate Caches / Restart).

Use Debug Variants: If you're working with product flavors or build variants, ensure you're accessing the correct variant of the BuildConfig class. If using different variants for debug and release builds, check if the issue arises only in a specific variant.

Consult Documentation: If the issue persists, refer to the Salesforce SDK documentation for any specific requirements related to BuildConfig and ensure that your implementation aligns with their guidelines.

Implementing these steps should help resolve the ClassNotFoundException for BuildConfig and restore expected functionality. If the problem continues, sharing additional context about recent changes made in the project may help diagnose the issue further

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

4 participants
@johnjeremih @Techfhil and others