Class 'MyApplication' is never used
Asked Answered
J

2

9

After I successfully integrated flurry SDK into the library by using this code in my build.gradle file.

    compile 'com.flurry.android:analytics:6.8.0'

I created java Class to integrate my API Key into my code, and since Im running my app on an external device I suppose some data needs to show on my flurry account, but it is now four days and nothing changed, only zeros are showing on my dashboard ...

Also, i have this message on my java file

Class 'MyApplication' is never used

enter image description here

Ps: I'm new to android studio

Jammiejammin answered 27/2, 2017 at 23:11 Comment(2)
Certainly the documentation that you should be reading mentions what to do with that class...?Kahlil
it not very clear, they included the code with i pasted but nothing elseJammiejammin
S
4

You must specify MyApplication in manifest file. It will not be used otherwise:

<application
    android:name=".MyApplication"
    ....
Settle answered 27/2, 2017 at 23:12 Comment(4)
i typed it like that <application <activity android:name=".MyApplication" ></activity> there is no error in MyApplication.java, but in manifest i got >My Application is not assignable to 'android.app.Activity' Validates ressource referances inside android XML file the code is working fine on my device no crashing at all, but will that error affect my code after ?Jammiejammin
@Marcin it is not a valid answer. After adding into Manifest, it still says that this class is never used.Rota
Don't blindly trust the linter: issuetracker.google.com/issues/74514347Settle
The warning still appears in Android Studio Arctic Fox 2020.3.1.1. Not even using the full class name of the custom Application class fixes it.Learned
S
-2

It's a class, not an activity. So you should write it as :

<application
    android:name=".MyApplication" //you should write like this
    android:allowBackup="true"
</application>
Siamang answered 6/10, 2017 at 12:14 Comment(1)
Its a bug in Android Studio issuetracker.google.com/issues/74514347Zagreb

© 2022 - 2024 — McMap. All rights reserved.