首页 > 解决方案 > Why do I get "Unresolved reference" for a class that the project does allow to reach?

问题描述

Background

I've made a tiny library that I've published on Github, which allows you to have auto-switching of texts every X ms :

https://github.com/AndroidDeveloperLB/AutomatedTextSwitcher

The project has a library and a sample modules. The sample uses the library, and the library has a single class (currently), called "AutomatedTextSwitcher".

The problem

For some reason, the project doesn't seem to be able to be built, as the IDE shows these errors:

C:\Users\User\Desktop\AutomatedTextSwitcher\app\src\main\java\com\example\user\automated_text_switcher\MainActivity.kt: (5, 47): Unresolved reference: AutomatedTextSwitcher C:\Users\User\Desktop\AutomatedTextSwitcher\app\src\main\java\com\example\user\automated_text_switcher\MainActivity.kt: (21, 35): Unresolved reference: setTextsToShow

What I've tried

The errors appear here even though when I use CTRL+mouse-left-click, the IDE reaches to the correct place in code.

The class exists, and the function of setTextsToShow also exists and is public.

Copying the code to an existing project seem to have it work fine.

Since I suspect this is a bug on the IDE, I've also reported about this here.

The question

How come I have this issue? Why does it occur? How can I fix it?

标签: android

解决方案


推荐阅读