0

正如标题所说,在平时开发过程中,如果我输入Activity,那么android.app.Activity会自动导入。但是在src/test目录下进行单元测试开发时,自动导入功能不可用。我必须反复按Alt+Enter才能导入类。有什么设置可以自动完成吗?或者有什么其他方法可以轻松...

4

1 回答 1

0

Try do those actions:

  • Close the Android Studio and open it again
  • Reload your project, clean the project and build it again. This should ensure that all packages in your projects have been loaded
  • Make sure that you do not have any graphic plugin that can affect your visual highlights code. I pass through it when i was using Material UI theme.
  • Check if the Auto Import is switched on in your settings
  • If you can see the red lamp in the left side of you code and click on it, you will see every wrong thing that the Android Studio can detect on your code, else maybe you are doing something wrong with your imports

  • If you are using Kotlin, remenber to use the Kotlin suport plugin

于 2017-08-15T03:26:39.713 回答