简体   繁体   English

kotlin 未解决的参考:其他库模块的类

[英]kotlin Unresolved reference: Class of the other library module

I have a library module: libCommon ,which contains a kotlin class:我有一个库模块: libCommon ,其中包含一个 kotlin 类:

open class Stu {
    var name=""
}

Have a default application module 'app' which api project(':libCommon'), Then create a class AStu in the app:有一个默认的应用程序模块'app' which api project(':libCommon'),然后在应用程序中创建一个类AStu:

import siger.common.base.Stu
class AStu: Stu() {
}

Then build the project, get the error: Unresolved reference: Stu然后编译项目,报错:Unresolved reference: Stu

But if change the Class Stu to java class, it gots okey.但是如果将 Class Stu 更改为 java 类,它就可以了。

How to make it with kotlin?如何用 kotlin 制作它? Did i miss sth.?我错过了什么吗? Any help will be appreciated.任何帮助将不胜感激。

found the Reason: Miss找到原因:小姐

apply plugin: 'kotlin-android' 

in the library module在库模块中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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