-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoSuchMethodError: No static method forceEnableAppTracing()V in class Landroidx/tracing/Trace #2248
Comments
From this comment:
It sounds like you're trying to update each of those dependencies in individual PRs, but notice that they're released together from a monorepo (even if their versions don't match). Try to bundle them all into 1 PR to reduce problems coming from mixing "AndroidX Test" versions. On the other hand, this looks like a duplicate of #1755. @brettchabot is there a way to fix this in this repo, without needing every single user to go through the pain of "Espresso is broken again" discovery, needing deeper understanding of Gradle dependency resolution? |
@TWiStErRob we have dependabot group update and it fails the same way FusionAuth/fusionauth-android-sdk#88, so #1755 is likely the issue. |
I don't think that is a correct explanation. Typically we do release all of the individual artifacts in this repo together, but they should be capable of being versioned independently . However, you cannot disregard the version constraints. In this case androidx.test:monitor:1.7.0 requires androidx.tracing:tracing:1.1.0
This is a fair complaint. I was hoping this could be fixed in Android gradle but after 1.5 years since first being reported that sadly seems unlikely. Here's what I can do:
Does that sound reasonable? |
Thanks for the additional infos @brettchabot Thanks |
@eric-labelle can you post a sample that repros the problem |
A release just went out with a workaround for this crash. Please update to androidx.test:monitor:1.7.1 |
Thanks for all the advice @brettchabot. I don't think our project has this androidx.test:monitor dependency. Is adding this dependency will fix the crash for us as well? |
Your project will transitively depend on androidx.test:monitor since almost all other artifacts depend on it. So just adding androidx.test:monitor:1.7.1 as an explicit dependency should fix it. Alternatively you could just increment what you do depend on eg androidx.test:core 1.6.1 |
@brettchabot We did try the alternative approach, and I can confirm that the new x.x.1 patch releases have addressed the issue that I raised. Now all of our test cases can be passed like normal. |
Having a really hard time reproducing it out of our project. |
This reverts b587f83 - the upstream android-test libraries have applied a workaround on their side (see android/android-test#2248 for details).
This reverts b587f83 - the upstream android-test libraries have applied a workaround on their side (see android/android-test#2248 for details).
After updating x.x.1 patch releases NoSuchMethodError has gone but now I'm getting such output: java.lang.IllegalStateException: Hilt Activity must be attached to an @HiltAndroidApp Application. Did you forget to specify your Application's class name in your manifest's 's android:name attribute? Note: previously all tests were working well |
@AlexeyCFRA can you file a new issue with details? Its not clear to me how an androidx.test.* update could cause an issue like that |
Description
Our project's Dependabot detected some new versions of the dependency updates related to AndroidX.test, but most of the updates came with this error "java.lang.NoSuchMethodError: No static method forceEnableAppTracing()V in class Landroidx/tracing/Trace; or its super classes (declaration of 'androidx.tracing.Trace' appears in /data/app/~~QG-KqkX7XjglpXiFeGkUVA==/com.example-app-Cp5gZmRoQKzfqLpHnN5jRg==/base.apk!classes29.dex)"
Moreover, some of the UI tests encountered another error"java.lang.NoClassDefFoundError: androidx.test.espresso.Espresso
"
Here's the list of the dependencies that we are trying to update:
androidx.test:core from 1.5.0 to 1.6.0 (no issue found from our CI)
androidx.test:rules from 1.5.0 to 1.6.0
androidx.test.ext:junit from 1.1.5 to 1.2.0
androidx.test:runner from 1.5.2 to 1.6.0
versionEspresso from 3.5.1 to 3.6.0
We are also using:
androidxTestExt = { group = "androidx.test.ext", name = "junit", version = "1.2.0" }
androidWorkerTest = { group = "androidx.work", name = "work-testing", version = "2.9.0" }
composeBom = { group = "androidx.compose", name = "compose-bom", version.ref = "2024.06.00" }
composeUiTest = { group = "androidx.compose.ui", name = "ui-test-junit4" }
mockkAndroidTest = { group = "io.mockk", name = "mockk-android", version.ref = "1.13.11" }
turbine = { group = "app.cash.turbine", name = "turbine", version = "1.1.0" }
And Kotlin 2.0
Steps to Reproduce
Run either compose test or espresso test.
Expected Results
All UI Tests should be able to run successfully
Actual Results
UI tests failed due to either "java.lang.NoSuchMethodError: No static method forceEnableAppTracing()" and "java.lang.NoClassDefFoundError: androidx.test.espresso.Espresso"
AndroidX Test and Android OS Versions
See the list on the description section.
Link to a public git repo demonstrating the problem:
It's my first time logging an issue. Let me know if any of you need more details. Thanks!
The text was updated successfully, but these errors were encountered: