Reputation: 672
I want to change targetSdkVersion of my android project from 25 to 27. The problem is that i used Kotlin and there are some big changes:
1) changed the signature of View.findViewById()
. Now I need to use findViewById<View>
2) getContext()
of Fragment became not null safety so I need to add !! to all context values in all fragments.
Is there any way to fix it automatically for whole project? This is not a small project and do this fixes manually will take a lot of time.
Upvotes: 1
Views: 129
Reputation: 36302
findViewById
that I know of. I believe I recorded a Vim (IdeaVim) macro to help me when I did it.getContext()
did not change, only the annotation did. In the past getContext()
could have returned null
, the compiler just didn't warn you. You should not try to find a way to ignore these errors, or even to add !!
to each usage. You should instead handle the case where the return value is null
and do the right thing in your application.Upvotes: 1