How to import a java package in Android Studio

只愿长相守 提交于 2019-12-05 00:37:00

If it's an existing code library, I'd recommend adding a module for it. Probably the easiest way is to use the File menu command to add a new module, let it create a plain Java (non-Android) module for you, remove the sample class it puts into the module, and then copy your files over into it and tweak it. The module wizard will take care of setting up the directories and build files for you, and you can look at it later and see what did.

Without pressing Alt + enter to import the Packages?

There is some steps like 1)File --->Settings --from left pane we find editor---->General--->Auto Import

There Insert imports on paste as ALL not ask

And put check mark for all the Above three Fields

1)Show import popup

2)Optimize the imports on fly

3)Add unambiguous imports on the fly

Click Apply and ok

Happy Coding......

If you have the sources import them in the src folder. Is the simple thing that you can do.

I suggest you to use the command line rather than Android Studio interface. If you work on Linux or MacOS, try to copy the package to your working direcotry like:

cp -r PACKAGE_NAME PATH_TO/AndroidStudioProjects/PROJECT_NAME/app/src/main/java/
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!