"library source does not match the bytecode for class" when transitive dependency uses implementation instead of api
I am publishing a Java library that contains a "sources Jar". You can find the `build.gradle` here. The whole minimal reproducible example project is here.
When the library is used in another project, Android Studio complains that the "library source does not match the bytecode for class" as you can see in the attached screenshot.
The problem appears when my library has a dependncy (I use Gson in the example) :
implementation 'com.google.code.gson:gson:2.8.6'
and declares a class variable of that type. .
If the consumer project adds the same dependancy in its `build.gradle`, then the sources appear normally in Android Studio without a warning . Alternatively, if the library uses API instead of implementation, the problem is not reproduced:
api'com.google.code.gson:gson:2.8.6'
Is this a bug? The produced jar files in my MavenLocal repo are here.

Please sign in to leave a comment.
Hi and thanks for taking the time to report this.
Let me look into it and get back to you.
I created a bug report for this on our issue tracker: IDEA-265876. Dev team will look into it shortly.
Feel free to follow the issue to stay updated on the progress of the investigation.
See this article if you are not familiar with YouTrack.
Hi Arina. I have already created a ticket here: https://youtrack.jetbrains.com/issue/IDEA-265862
I can't see the ticket you created. Can you merge them?
No worries Πέτρος, already done.
We were able to reproduce the problem, thank you.