Search code examples
javaandroidandroid-studiojsr310threetenbp

How to ignore java.time package in Android Studio


I am currently working on an Android Studio project with a minimum API version of 17 (JellyBean), so I cannot use the java.time package. Instead, I am using the ThreeTen backport for Android (com.jakewharton.threetenabp:threetenabp:1.1.0).

My problem is that every class in com.threeten.bp matches one in java.time, and I find that it is very easy to accidentally import the wrong class, since the auto-complete popup shows the java.time option first. I need a way to just remove that java.time package from my project, or at least tell Android Studio to ignore it. Is it possible to do that?


Solution

  • You can disable auto-import classes of this package. Add java.time into:

    Editor--> General --> Auto import --> exclude from import and completion