6

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?

Leo Aso
  • 11,898
  • 3
  • 25
  • 46
  • You cannot remove it from the project, other than by setting a low enough `compileSdkVersion`, from before `java.time` was added. That won't work very well for the rest of your app, though. I don't know if there is a way to tailor auto-complete to filter out certain packages, though that sounds like a nice feature. – CommonsWare Jul 07 '18 at 12:30

1 Answers1

5

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

Editor--> General --> Auto import --> exclude from import and completion
xingbin
  • 27,410
  • 9
  • 53
  • 103