Closed ZakTaccardi closed 4 years ago
As a temporary workaround, you can suppress this in lint in your lint XML config
<lint>
<!-- Temporary until https://github.com/Kotlin/kotlinx.coroutines/issues/2004 is resolved. -->
<issue id="InvalidPackage">
<ignore path="**/kotlinx-coroutines-core-*.jar"/>
</issue>
</lint>
This is indeed a very unfortunate problem, we never tested lint check.
Ignoring core artifact should be completely safe, actual code with java.lang.instrument
is never loaded (unless core artifact is used as an argument to -javaagent
).
Hopefully, I will release a 1.3.7 release with lint suppression next week
I've published a fixed version 1.3.6-lint
to my bintray and tested it against a bunch of trivial projects.
It would be nice if someone could verify it against their (likely more complex and real-world-ish) projects before we release it as 1.3.7.
@qwwdfsad I confirm that the 1.3.6-lint
works.
The Builds went through our CI/CD and our Monorepo project works as expected.
We have quite a large codebase that heavily relies on the coroutines core and android lib, and we just refactored our Channels
to the new StateFlow
.
I couldn't observe any abnormalities.
@qwwdfsad I too can confirm that 1.3.6-lint
works for my project. All CI checks passed for us. 🙂 🎉
Same here
Works for my projects!
I'm seeing exactly the same problem on 1.6.1:
../../../../../../.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.6.1-native-mt/ee5d3def1a25e11bb9450ce73c7dd1d8163ec856/kotlinx-coroutines-core-jvm-1.6.1-native-mt.jar: Error: Invalid package reference in org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm; not included in Android: java.lang.instrument. Referenced from kotlinx.coroutines.debug.AgentPremain. [InvalidPackage]
Explanation for issues of type "InvalidPackage":
This check scans through libraries looking for calls to APIs that are not included in Android.
When you create Android projects, the classpath is set up such that you can only access classes in the API packages that are included in Android.
However, if you add other projects to your libs/ folder, there is no guarantee that those .jar files were built with an Android specific classpath, and in particular, they could be accessing unsupported APIs such as java.applet.
This check scans through library jars and looks for references to API packages that are not included in Android and flags these. This is only an error if your code calls one of the library classes which wind up referencing the unsupported package.
Should I reopen the issue?
I'm seeing the following Android lint error when upgrading from
1.3.5
to1.3.6