Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 551
Hoornet Avatar asked May 11 '18 12:05

Hoornet


2 Answers

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

@Suppress("unused")
like image 143
Stephen Avatar answered Sep 29 '22 23:09

Stephen


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.

like image 33
NickM_RG Avatar answered Sep 29 '22 23:09

NickM_RG