简体   繁体   中英

Jar produced by Kotlin Multiplatform Library project not visible in Android Studio

I have created minimal project based on official tutorial https://kotlinlang.org/docs/reference/mpp-create-lib.html

Gradle build produces.jar file which looks good (stream-api-lib-jvm-1.0-SNAPSHOT.jar)

But when I include this jar (manually) into my Android Studio project, it cannot find the classes (Invalidating cache already tried).

罐子内容

Gradle config changes for adding the lib (into app/libs)

implementation fileTree(include: ['*.jar'], dir: 'libs') 
implementation files('libs/stream-api-lib-jvm-1.0-SNAPSHOT.jar')

Finally found the reason: in my case kotlin file in library which I tried to access, did not have the "package" directive on top.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM