helpcrunch / android-sdk-demo

Public demo for HelpCrunch Android SDK
Apache License 2.0
9 stars 1 forks source link

NoSuchFieldException: No field mGradientRadiusType in class android/graphics/drawable/GradientDrawable$GradientState #74

Closed yaroslav-v closed 1 year ago

yaroslav-v commented 1 year ago

Hi!

The latest version 3.3.0 has a couple of warnings regarding accessing hidden fields and NoSuchFieldException. These warnings weren't presented on 3.2.6, not sure about the versions between.

Here is the log:

   W  Accessing hidden field Landroid/graphics/drawable/GradientDrawable$GradientState;->mGradientRadiusType:I (max-target-o, reflection, denied)

System.err  W  java.lang.NoSuchFieldException: No field mGradientRadiusType in class Landroid/graphics/drawable/GradientDrawable$GradientState; (declaration of 'android.graphics.drawable.GradientDrawable$GradientState' appears in /system/framework/framework.jar)
   W    at java.lang.Class.getDeclaredField(Native Method)
   W    at top.defaults.drawabletoolbox.CompatibleKt.resolveField(Compatible.kt:33)
   W    at top.defaults.drawabletoolbox.CompatibleKt.setGradientRadiusType(Compatible.kt:136)
   W    at top.defaults.drawabletoolbox.DrawableBuilder.setupGradientDrawable(DrawableBuilder.kt:306)
   W    at top.defaults.drawabletoolbox.DrawableBuilder.build(DrawableBuilder.kt:187)
   W    at com.helpcrunch.library.u3.t(HcChatFragment.kt:17)
   W    at com.helpcrunch.library.v.onViewCreated(BaseFragment.kt:5)
   W    at com.helpcrunch.library.u3.onViewCreated(HcChatFragment.kt:1)
   W    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3128)
   W    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:552)
   W    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
   W    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899)
   W    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1817)
   W    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1760)
   W    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2985)
   W    at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2895)
   W    at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:263)
   W    at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:351)
   W    at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:251)
   W    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1543)
   W    at android.app.Activity.performStart(Activity.java:8330)
   W    at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3670)
   W    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
   W    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
   W    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
   W    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
   W    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
   W    at android.os.Handler.dispatchMessage(Handler.java:106)
   W    at android.os.Looper.loopOnce(Looper.java:201)
   W    at android.os.Looper.loop(Looper.java:288)
   W    at android.app.ActivityThread.main(ActivityThread.java:7872)
   W    at java.lang.reflect.Method.invoke(Native Method)
   W    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
   W    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
...   
   W  Accessing hidden field Landroid/graphics/drawable/GradientDrawable$GradientState;->mGradientRadius:F (max-target-o, reflection, denied)
System.err   W  java.lang.NoSuchFieldException: No field mGradientRadius in class Landroid/graphics/drawable/GradientDrawable$GradientState; (declaration of 'android.graphics.drawable.GradientDrawable$GradientState' appears in /system/framework/framework.jar)
...

Environment: a default Android emulator API 33 with Google Play

TalbotGooday commented 1 year ago

Hi! Thanks for the reporting! This warning was on 3.2.6 'cause it's from the third-party lib called drawabletoolbox. Unfortunately, we can't hide them or something :c

yaroslav-v commented 1 year ago

I'm not sure if it's necessary, as far as there's no option to fix the warning, but I've rechecked how it looks like on different version of SDK:

The warnings appear when you call showChatScreen().

yaroslav-v commented 1 year ago

Tested one more time and it happens on v3.2.6 too.

The only difference in my case is that on v3.2.6 I see firstly the list of all chats and on the newer versions it shows the chat view directly. Obviously, that happens because of https://github.com/helpcrunch/android-sdk-demo/issues/73