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

Library source does not match the byte code

Open lwasyl opened this issue 4 years ago • 4 comments

For some classes, like ViewInteraction or RootViewPicker, IDE reports that library source doesn't match the byte code:

image

This makes it quite difficult to debug issues step by step

Espresso 3.2.0

lwasyl avatar Feb 20 '20 15:02 lwasyl

Same Problem

yongjiliu avatar Sep 17 '21 09:09 yongjiliu

This is likely because jarjar is used to shade Guava deps during the build, that seems to mess up the debug symbols/line numbers in the resulting class files.

https://github.com/android/android-test/blob/45073bc6751ab0c5cb5cb2349fab1610971735ef/espresso/core/java/androidx/test/espresso/remote/release_jarjar_rules.txt#L1

yogurtearl avatar Jul 29 '22 22:07 yogurtearl

I confirmed that removing jarjar fixes this. I downloaded and build the code locally with jarjar disabled, and this problem goes away.

yogurtearl avatar Aug 02 '22 17:08 yogurtearl

A couple of options to fix this:

  1. Fix jarjar so that it keeps line numbers intact, and the published -sources.jar matches the published .jar
  2. Remove jarjar
    • The guava usages can be fairly easily removed and replaced with kotlin or inline copy/paste from Guava.
    • The Dagger usage can just be declared as a proper transitive dep.
  3. Convert the build to gradle like the rest of AndroidX and either don't shadow anything or use the shadow plugin.

yogurtearl avatar Aug 02 '22 17:08 yogurtearl

Please give espresso 3.6.0-alpha01 a try. It still uses jarjar to rename dagger, but guava has been removed entirely.

brettchabot avatar Mar 27 '23 18:03 brettchabot