在intelliJ中包不存在错误

时间:2021-09-18 07:08:39

I'm trying to use the barbecue barcode printing library. I have successfully added the library to IntelliJ through project structure add library. Then I imported the packages and wrote the methods, which gave me no error. The packages were available in the class.

我正在尝试使用烧烤条码打印库。我已经通过项目结构添加库成功地将库添加到IntelliJ。然后我导入了包并编写了方法,这没有给我任何错误。这些包在课堂上可用。

But when I compile it gives me the error:

但是当我编译它时会给我错误:

error: package net.sourceforge.barbecue does not exist

How can this be?

怎么会这样?

I'm coding in ubuntu, is there any other place to which I have to add the library?

我在ubuntu编码,还有其他地方我要添加库吗?

Thanks. Tika

谢谢。提卡

10 个解决方案

#1


28  

I tried to "Maven > Reimport" but the only thing that actually fixed it was to close the project, delete the .idea directory, and reopen the project.

我试图“Maven> Reimport”,但实际修复它的唯一办法是关闭项目,删除.idea目录,然后重新打开项目。

#2


26  

Right click your project / Maven (at bottom) / Reimport

右键单击您的项目/ Maven(底部)/ Reimport

#3


9  

If you added a library to the project structure (rather than via maven, that would be different), be sure it is included as a dependency for the relevant module.

如果您将一个库添加到项目结构中(而不是通过maven,那将是不同的),请确保它作为相关模块的依赖项包含在内。

Project Structure -> Modules -> Dependencies

项目结构 - >模块 - >依赖项

#4


7  

Just reimport didn't work. Following worked for me.

只是重新进口没有用。以下为我工作。

File -> Invalidate Caches /Restart

文件 - >使高速缓存/重新启动无效

Then

然后

Build -> Rebuild Project

构建 - >重建项目

That will reimport maven project.

这将重新进口maven项目。

#5


6  

menu -> build -> Rebuild Project

has worked for me

对我有用

(Invalidating caches without this step doesn't help)

(没有此步骤使缓存无效无效)

#6


3  

Tried all the above approaches, didn't work. Finally running maven clean install solved it!

尝试了以上所有方法,没有奏效。终于运行maven clean install解决了!

#7


1  

Invalidate Caches/ Restart and then Build -> Rebuild Project helped for me

使高速缓存/重新启动无效,然后构建 - >重建项目对我有帮助

#8


0  

I had the same problem. I fixed it by applying the android-apt plugin https://bitbucket.org/hvisser/android-apt

我有同样的问题。我通过应用android-apt插件https://bitbucket.org/hvisser/android-apt来修复它

#9


0  

I had the same problem and it was fixed for me by changing the "Maven home directory" in Settings from "Bundled" to my locally installed maven. Perhaps this triggered some kind of refresh somewhere since I had not changed this setting for months without any issue.

我遇到了同样的问题,通过将设置中的“Maven主目录”从“Bundled”更改为我本地安装的maven,我得到了修复。也许这引发了某种形式的刷新,因为我几个月没有改变这个设置没有任何问题。

#10


0  

Same problem, I quit IntelliJ, remove every ".idea" directory "rm -Rf **/.idea/" and restart.

同样的问题,我退出IntelliJ,删除每个“.idea”目录“rm -Rf ** /。idea /”并重新启动。

#1


28  

I tried to "Maven > Reimport" but the only thing that actually fixed it was to close the project, delete the .idea directory, and reopen the project.

我试图“Maven> Reimport”,但实际修复它的唯一办法是关闭项目,删除.idea目录,然后重新打开项目。

#2


26  

Right click your project / Maven (at bottom) / Reimport

右键单击您的项目/ Maven(底部)/ Reimport

#3


9  

If you added a library to the project structure (rather than via maven, that would be different), be sure it is included as a dependency for the relevant module.

如果您将一个库添加到项目结构中(而不是通过maven,那将是不同的),请确保它作为相关模块的依赖项包含在内。

Project Structure -> Modules -> Dependencies

项目结构 - >模块 - >依赖项

#4


7  

Just reimport didn't work. Following worked for me.

只是重新进口没有用。以下为我工作。

File -> Invalidate Caches /Restart

文件 - >使高速缓存/重新启动无效

Then

然后

Build -> Rebuild Project

构建 - >重建项目

That will reimport maven project.

这将重新进口maven项目。

#5


6  

menu -> build -> Rebuild Project

has worked for me

对我有用

(Invalidating caches without this step doesn't help)

(没有此步骤使缓存无效无效)

#6


3  

Tried all the above approaches, didn't work. Finally running maven clean install solved it!

尝试了以上所有方法,没有奏效。终于运行maven clean install解决了!

#7


1  

Invalidate Caches/ Restart and then Build -> Rebuild Project helped for me

使高速缓存/重新启动无效,然后构建 - >重建项目对我有帮助

#8


0  

I had the same problem. I fixed it by applying the android-apt plugin https://bitbucket.org/hvisser/android-apt

我有同样的问题。我通过应用android-apt插件https://bitbucket.org/hvisser/android-apt来修复它

#9


0  

I had the same problem and it was fixed for me by changing the "Maven home directory" in Settings from "Bundled" to my locally installed maven. Perhaps this triggered some kind of refresh somewhere since I had not changed this setting for months without any issue.

我遇到了同样的问题,通过将设置中的“Maven主目录”从“Bundled”更改为我本地安装的maven,我得到了修复。也许这引发了某种形式的刷新,因为我几个月没有改变这个设置没有任何问题。

#10


0  

Same problem, I quit IntelliJ, remove every ".idea" directory "rm -Rf **/.idea/" and restart.

同样的问题,我退出IntelliJ,删除每个“.idea”目录“rm -Rf ** /。idea /”并重新启动。