airbnb / mavericks

Mavericks: Android on Autopilot
https://airbnb.io/mavericks/
Apache License 2.0
5.83k stars 500 forks source link

Fixing #699 java.lang.SecurityException #700

Closed danpe closed 11 months ago

danpe commented 11 months ago

Fixes #699

danpe commented 11 months ago

Thank you! Can you also make a release please? 🙏

On Fri, Nov 3, 2023, 21:54 Eli Hart @.***> wrote:

Merged #700 https://github.com/airbnb/mavericks/pull/700 into main.

— Reply to this email directly, view it on GitHub https://github.com/airbnb/mavericks/pull/700#event-10860041331, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQKRIYEHYN33KTODKVGQ5DYCVDXZAVCNFSM6AAAAAA6YI3AFKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJQHA3DAMBUGEZTGMI . You are receiving this because you were mentioned.Message ID: @.***>

elihart commented 11 months ago

I can make a release next week. I'm still curious though, if you are seeing these crashes in production, if you should instead be changing your config to not run the mock printer code in prod builds

danpe commented 11 months ago

I can make a release next week. I'm still curious though, if you are seeing these crashes in production, if you should instead be changing your config to not run the mock printer code in prod builds

It is weird as even if I disable mocking completely it still crashes,

        MockableMavericks.initialize(
            mocksEnabled =false
            debugMode = false,
            applicationContext = this,
            //TODO maybe use other dispatchers
            viewModelCoroutineContext = Dispatchers.Default,
            stateStoreCoroutineContext = Dispatchers.Default
        )

Still crashes on startup...

elihart commented 11 months ago

That doesn't control the mock printer configuration. You must be calling registerMockPrinter somewhere in your app. Don't call it in production builds...

danpe commented 11 months ago

That doesn't control the mock printer configuration. You must be calling registerMockPrinter somewhere in your app. Don't call it in production builds...

Tbh, we don't call registerMockPrinter anywhere in our app, that why it is strange.

elihart commented 10 months ago

It seems like you'll want to figure out the root cause of why the mock printer is registering in your production app. Even if you apply this fix you still don't want the broadcast receiver starting in your prod app.

Look at how you might be using MockableMavericks.enableMockPrinterBroadcastReceiver, or manual instantiation of MavericksMockPrinter

danpe commented 10 months ago

Hi @elihart , thank you for responding. TBH, I did Find All.. (Cmd+Shift+F) and tried looking for both enableMockPrinterBroadcastReceiver and MavericksMockPrinter in all my files and modules.

Nothing found.

mlengy commented 10 months ago

Hi @elihart, thanks for the fix. Currently running into this issue when attempting to target API 34 as well. Curious when a new release would be possible. Thanks!

elihart commented 10 months ago

I'll get a release out this week

ArunYogeshwaran commented 2 months ago

Thanks for this fix. It helped us when we upgraded our target SDK version to 34