Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 389
Leo Aso Avatar asked Jul 07 '18 12:07

Leo Aso


People also ask

Does Android Studio install JDK?

A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.

Which version of Java is used in Android Studio?

Android Studio supports all the same programming languages of IntelliJ (and CLion) e.g. Java, C++, and more with extensions, such as Go; and Android Studio 3.0 or later supports Kotlin and "all Java 7 language features and a subset of Java 8 language features that vary by platform version." External projects backport ...

How do I change the project language in Android Studio?

Go to app > res > values > right-click > New > Value Resource File and name it as strings. Now, we have to choose qualifiers as Locale from the available list and select the language as Hindi from the drop-down list. Below is the picture of the steps to be performed.


1 Answers

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

Editor--> General --> Auto import --> exclude from import and completion
like image 181
xingbin Avatar answered Sep 22 '22 15:09

xingbin