Wednesday, May 5, 2021

Resource IDs will be non-final in Android Gradle Plugin version 7.0, avoid using them in switch case statements

AndroidStudio를 4.2로 업데이트했더니 아래 문구가 Probleams에 뜬다.


 Resource IDs will be non-final in Android Gradle Plugin version 7.0, avoid using them in switch case statements


현재 gradle 정식 최신 버전은 

Android Gradle Plugin Version 4.2.0

Gradle Version 6.7.1

인데 Project Structure의 Project 탭의 버전 셀렉트버튼을 클릭해보니 7.0이 있다.

gradle version은 이미 7.0이 있었고 Gradle Plugin Version은 7.0.0-alpha 버전들이 쭈욱 있었다.


4.2.0에서 7.0이라니...


곧 둘다 버전을 7로 맞출려나 보다. 



7.0에서 final이 빠진다니 미리 switch문을 if문으로 바꿔주자.



우선 AndroidStudio 에서 swith문을 if문으로 바꿀려면 


swith문 위에서  Alt+Enter를 치면 나온다.


또는 

Solution is simple:

  • File > Settings > Editor > Intentions - Search: "replace switch"

or

  • File > Settings - Search: "replace switch" > Editor > Intentions

and check the blank checkbox




https://stackoverflow.com/questions/28259009/how-to-automatically-convert-if-else-if-statement-to-switch

No comments:

Post a Comment