Hoornet
Hoornet

Reputation: 1418

SomeApp "is never used"

Below in the image 1 you can see I created a Kotlin class that extends from the Application() class: screenshot from Android Studio 3.1.2

I also added the necessary stuff in my Manifest file as you can see in the next image: Manifest file

However I can't figure out why Android Studio maintains that I am NOT using my Class at all! It is underlined and grayed out and on mouse over you see the message "Class XZY is never used."

The same behavior I noticed in Versions of Android Studio different from my current one, which is 3.1.2. Of note might be that if I create the same class in Java, Android Studio functions as it should and knows that I use the class if I mention it in my Manifest file. Any ideas how to convince the Android Studio that I am actually using this class?

Upvotes: 11

Views: 1575

Answers (3)

Satyam Gupta
Satyam Gupta

Reputation: 464

That is bug and it's not yet solved what i did was adding this line before the class

@Suppress("unused")

Upvotes: 1

NickM_RG
NickM_RG

Reputation: 29

This is a bug in Android Studio. Here is a link to Google Issue Tracker (requires Google account). It was reported there by a few users in March 2018 and got little attention from Google staff ever since.

Upvotes: 3

GBDevs
GBDevs

Reputation: 96

Try to select Invalidate Caches/Restart from menu File tab.

Upvotes: 0

Related Questions