Appboy / appboy-android-sdk

Public repo for the Braze Android SDK
https://www.braze.com
Other
153 stars 102 forks source link

[Bug]: #220

Closed dorukkangal closed 2 years ago

dorukkangal commented 2 years ago

Braze Android SDK Version

18.0.1

Steps To Reproduce

When we use Braze with the Sentry Gradle Plugin, the application crashes when opened

Gradle version 7.1.2
Kotlin Version 1.6.10
Target Sdk Version 32
Compile Sdk Version 32
Braze Version 18.0.1
Sentry Version 5.7.0
Sentry Plugin Version 3.0.0

Expected Behavior

The application should not be crashed

Actual Incorrect Behavior

The application crashes when opened

Verbose Logs

java.lang.VerifyError: Verifier rejected class com.braze.support.BrazeImageUtils: android.graphics.Bitmap com.braze.support.BrazeImageUtils.getLocalBitmap(android.net.Uri, int, int) failed to verify: android.graphics.Bitmap com.braze.support.BrazeImageUtils.getLocalBitmap(android.net.Uri, int, int): [0x75] register v6 has type Precise Reference: java.lang.String but expected Reference: java.io.FileInputStream (declaration of 'com.braze.support.BrazeImageUtils' appears in /data/app/~~mudJ3b4VR55TXuQMIoS8ew==/com.hepsiburada.merchant.qa-oFX-w_fRWgtmWrKbDRq6yg==/base.apk)
        at com.braze.support.BrazeImageUtils.getImageLoaderCacheSize(SourceFile:1)
        at com.braze.images.DefaultBrazeImageLoader.<init>(SourceFile:4)
        at com.appboy.Appboy.<init>(SourceFile:59)
        at com.braze.Braze.<init>(SourceFile:1)
        at com.appboy.Appboy.getInstance(SourceFile:7)
        at com.hepsiburada.merchant.di.AppModule.provideBraze(AppModule.kt:46)
        at com.hepsiburada.merchant.di.AppModule_ProvideBrazeFactory.provideBraze(AppModule_ProvideBrazeFactory.java:41)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$SwitchingProvider.get0(DaggerApp_HiltComponents_SingletonC.java:2011)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$SwitchingProvider.get(DaggerApp_HiltComponents_SingletonC.java:2354)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$SwitchingProvider.get0(DaggerApp_HiltComponents_SingletonC.java:2008)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$SwitchingProvider.get(DaggerApp_HiltComponents_SingletonC.java:2354)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$SwitchingProvider.get0(DaggerApp_HiltComponents_SingletonC.java:1993)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$SwitchingProvider.get(DaggerApp_HiltComponents_SingletonC.java:2354)
        at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$ActivityCImpl.injectMainActivity2(DaggerApp_HiltComponents_SingletonC.java:1506)
        at com.hepsiburada.merchant.core.DaggerApp_HiltComponents_SingletonC$ActivityCImpl.injectMainActivity(DaggerApp_HiltComponents_SingletonC.java:1474)
        at com.hepsiburada.merchant.ui.Hilt_MainActivity.inject(Hilt_MainActivity.java:66)
        at com.hepsiburada.merchant.ui.Hilt_MainActivity$1.onContextAvailable(Hilt_MainActivity.java:37)
        at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
        at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:313)
        at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:249)
        at com.hepsiburada.merchant.utils.base.BaseActivity.onCreate(BaseActivity.kt:30)
        at com.hepsiburada.merchant.ui.MainActivity.onCreate(MainActivity.kt:69)
        at android.app.Activity.performCreate(Activity.java:8054)
        at android.app.Activity.performCreate(Activity.java:8034)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7842)
        at java.lang.reflect.Method.invoke(Native Method)

Additional Information

No response

radixdev commented 2 years ago

Hi @dorukkangal ,

Thanks for filing.

  1. Can you verify if this issue occurs on Kotlin version 1.6.0?
  2. Can you post your android gradle plugin version?
  3. Can you post your R8 version as well? It's present in your build/outputs/mapping/**/mapping.txt file.
dorukkangal commented 2 years ago

Hi,

Yes, this issue also occurs in Kotlin 1.6.0. Also, you can find the library versions below:

Target Sdk Version: 32
Compile Sdk Version: 32

Gradle Plugin Version: 7.1.2
R8 Version: 3.1.66

Kotlin Version: 1.6.10

Braze Version: 18.0.1

Sentry Version: 5.7.0
Sentry Plugin Version: 3.0.0
radixdev commented 2 years ago

Hi @dorukkangal ,

We will be investigating this issue and will update you with anything we find shortly. Thank you for your patience.

radixdev commented 2 years ago

Hi @dorukkangal ,

To assist us with reproducing this issue, can you create and link to a small sample project repository that demonstrates the issue?

dorukkangal commented 2 years ago

Hi @radixdev,

You can reproduce this problem with the repository given below: https://github.com/dorukkangal/braze-sample

Thanks

radixdev commented 2 years ago

Hi @dorukkangal ,

Thank you for the sample repository. I added the following below and fixed the VerifyError. I believe this to be a bug in the Sentry gradle plugin and not our SDK as a result.

sentry {
    // Enable or disable the tracing instrumentation.
    // Does auto instrumentation for specified features through bytecode manipulation.
    // Default is enabled.
    tracingInstrumentation {
        enabled.set(false)
    }
}

As this is doing bytecode manipulation, it most likely changed the compiled bytecode of our SDK and thus caused a VerifyError in the process.

radixdev commented 2 years ago

Hey @dorukkangal ,

I'm closing this issue for now. Please let me know if you continue to have issues and we'll debug further.