android-test icon indicating copy to clipboard operation
android-test copied to clipboard

androidx.test.internal.runner.InstrumentationConnection.init error in androidU

Open fanluo opened this issue 2 years ago • 1 comments

Description

In androidU,if the app target is 34 , when we registerReceiver,we must use the RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED flag , but the class InstrumentationConnection did not do this when it int. so my app is crash on androidU devices

the error code in InstrumentationConnection is on line 173 targetContext.registerReceiver(messengerReceiver, new IntentFilter(BROADCAST_FILTER));

Expected Results

I want the class InstrumentationConnection on line 173 like this: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { targetContext.registerReceiver(messengerReceiver, new IntentFilter(BROADCAST_FILTER),Context.RECEIVER_EXPORTED); } else { targetContext.registerReceiver(messengerReceiver, new IntentFilter(BROADCAST_FILTER)); }

Link to a public git repo demonstrating the problem:

https://developer.android.google.cn/guide/components/broadcasts#context-registered-receivers

fanluo avatar Aug 30 '23 09:08 fanluo

Can you provide more details? What versions of the libraries are you using, ideally a complete sample project. We have many passing tests that target and run on android U

brettchabot avatar Aug 30 '23 16:08 brettchabot