编程语言
首页 > 编程语言> > Java-NetBeans不喜欢lib-src中的库

Java-NetBeans不喜欢lib-src中的库

作者:互联网

我正在与一个使用Eclipse的小组一起开发一个项目,但是我正在使用Netbeans.直到今天,这都不是问题.从仓库进行更新时,他们在作为/ lib-src目录下的库中添加了一些源代码.当我尝试编译代码时,出现错误,提示找不到某些软件包…这些是/ lib-src下的软件包.

使用NetBeans,我可以将库添加为文件夹,以便现在可以轻松地引用这些软件包.但是,在编译时出现了这个新错误:

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: Java heap space
    at java.util.HashMap.addEntry(HashMap.java:753)
    at java.util.HashMap.put(HashMap.java:385)
    at com.android.dx.dex.file.ClassDataItem.addStaticField(ClassDataItem.java:134)
    at com.android.dx.dex.file.ClassDefItem.addStaticField(ClassDefItem.java:280)
    at com.android.dx.dex.cf.CfTranslator.processFields(CfTranslator.java:159)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:130)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
    at com.android.dx.command.dexer.Main.processClass(Main.java:297)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:276)
    at com.android.dx.command.dexer.Main.access$100(Main.java:56)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:228)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:134)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
    at com.android.dx.command.dexer.Main.processOne(Main.java:245)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
    at com.android.dx.command.dexer.Main.run(Main.java:139)
    at com.android.dx.command.dexer.Main.main(Main.java:120)
    at com.android.dx.command.Main.main(Main.java:87)
/home/aaron/NetBeansProjects/xbmc-remote/nbproject/build-impl.xml:411: exec returned: 3
BUILD FAILED (total time: 1 minute 25 seconds)

如果需要,我可以包含build-impl.xml文件,但是我认为这不是主要问题.

有任何想法吗?

解决方法:

this thread一样,是否以某种方式涉及dx.bat?

It seems that Android built tools do not use ANT_OPTS variable while running dex tool.
Problem can be solved by uncommenting line in dx.bat batch file.

You can find it in android SDK folder under platforms/YOUR_PLATFORM/tools/dx.bat.
At the very end of file there is commented command to increase heap space.
Uncommenting this line should solve the problem. Line should looks like this:

set javaOpts=-Xmx256M

标签:eclipse,netbeans,java,android
来源: https://codeday.me/bug/20191210/2099392.html