gpt4 book ai didi

android-studio - Android Studio 不显示导入建议

转载 作者:行者123 更新时间:2023-12-03 18:00:06 24 4
gpt4 key购买 nike

Click here to see bug

No module suggestion for import command

在尝试使用“compile 'com.google ...'”添加 GSON 库后,我遇到一种情况,即当我尝试导入模块时,IDE 除了静态和 *.所以我必须输入所有内容。我该如何解决?我创建了新项目,但仍然遇到这个问题。

最佳答案

我们处于 21 世纪,使用现代 IDE Android Studio。为什么要手动导入包,就像我们在简单的记事本或任何其他文本编辑器中编写代码时导入一样?

只需键入要在代码中使用的类的名称。 IDE 足够智能,可以显示与您键入的关键字相关的建议。

I get a situation that when i try to import modules the IDE suggest me nothing except static and *.



是的,确实如此。这是我的截图

screenshot 1

How can I fix it?



非常简单。只需键入任何你想要的类名,然后从建议中选择它。 Android Studio 会自动导入它。

例如(根据您的要求)您要导入 @SerializedName()注解。输入 @Ser并点击 Ctrl + Space并看到魔法。

screenshot 2

现在 Android Studio 向我展示了与关键字 Ser 匹配的建议我会选择 SerializedName (com.google.gson.annotations.SerializedName) .就是这样。

希望它会有所帮助。

关于android-studio - Android Studio 不显示导入建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47701261/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com