android / codelab-android-accessibility

Basic Android Accessibility: making sure everyone can use what you create!
https://codelabs.developers.google.com/codelabs/basic-android-accessibility/
Apache License 2.0
112 stars 86 forks source link

CounterInstrumentedTest.testIncrement fails with IllegalAccessError with AccessibilityChecks.enable() #32

Open scottyab opened 2 years ago

scottyab commented 2 years ago

Cloned the repo form master commit, run CounterInstrumentedTest.testIncrement() from Android studio, passes ok. Uncomment AccessibilityChecks.enable() rerun but now get the following error.

Running on Pixel 3: Android 12.

java.lang.IllegalAccessError: Illegal class access: 'androidx.test.core.app.ListFuture' attempting to access 'androidx.concurrent.futures.DirectExecutor' (declaration of 'androidx.test.core.app.ListFuture' appears in /data/app/~~b3Jx6X51YqdMTTUNCqksUQ==/com.example.android.accessibility.counter.test-MHSAY5Inv8Zy8Mdz4MPhUQ==/base.apk)
    at androidx.test.core.app.ListFuture.directExecutor(ListFuture.java:139)
    at androidx.test.core.app.ListFuture.init(ListFuture.java:101)
    at androidx.test.core.app.ListFuture.<init>(ListFuture.java:84)
    at androidx.test.core.app.DeviceCapture$forceRedrawGlobalWindowViews$1.run(DeviceCapture.kt:151)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    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)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
scottyab commented 2 years ago

Seems to be an issue with androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.5.0-alpha03' according to this SO post