1

I just imported a project in my Android Studio. When I tried to refactor the package name, I started facing errors. I am a beginner in Android so just need your help. When I refactored the package name by renaming the first folder after java. It did change the folder name but there were some imports in files of java (generated). Now I am unable to optimize imports in the generated files as it cannot be changed and all the changes are lost.

ERRORS screenshot

Mikalai Lushchytski
  • 1,563
  • 1
  • 9
  • 18
BasitBee
  • 35
  • 8

3 Answers3

1

you are under java (generated) folder ...

those java files should not be edited...

those are generated by compiler....

it is clearly written above it should not be edited

as you said I am trying to refactor the package name just refer this this

Thanks

Wini
  • 1,906
  • 1
  • 12
  • 31
  • @BasitBee you are under java (generated) folder ...those java files should not be edited...those are generated by compiler....it is clearly written above it should not be edited – Wini Sep 30 '20 at 05:42
  • Then how can I optimize the imports? As I am trying to refactor the package name. – BasitBee Sep 30 '20 at 05:44
  • refer this for refactoring --> https://stackoverflow.com/a/29092698/12553303 – Wini Sep 30 '20 at 05:46
  • 2
    Thanks @Wini, your reference helped. The issue is solved by doing "Clean Project" and "Rebuild Project" after refactoring. – BasitBee Sep 30 '20 at 05:58
-1

from Android Studio IDE file menu -> Invalidate Cache and restart -> Invalidate Cache and restart.

this should solve your errors

Remon Shehatta
  • 1,324
  • 1
  • 10
  • 21
-1

If you are planning to change the name of the package try this answer. what is the purpose to edit a generated file

Sindujan Nirmalan
  • 470
  • 1
  • 8
  • 18