I have just starting working my android studio project in another pc with same android studio version and it automatically makes used import statement as unused in the code and mark evey code related to particular import statement red. How can i fix this issue , its very annoying. but when i run the project ,it works fine without any error.
I have tried all those tricks including deleting .ide ,.gradle and even restarting with invalidate cash ,restard and disabling automatic import as well.
In the below screenshot , android studio just grayout all import statment i am using below and mark all those classes and its related method red in the code. how can i fix this issue
MyAppObserver
is unused import because you import it in the same file it's declared. As for others I am not sure because I can't see full file structure.
Your interface of the same name is causing a conflict.
interface MyAppObserver
Rename your interface and the imports should work correctly, and the red marks should go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With