我正在尝试启动 OSGI 框架并在 Android 上启动一些捆绑包。其中一个包是 18.5 MB jar 的 android API 包。我读到,为了在 android 上启动 bundle,所有的 bundle 都应该首先被 dexified。
所以我尝试使用以下命令对这个“android-4.1.1_r1.jar”进行dexify:
dx --dex --output=classes.dex C:\Users\student\Documents\eclipse\myPlugins\plugins\android-4.1.1_r1.jar
但我在命令行上收到此错误:
java.lang.OutOfMemoryError: Java heap space
第一:我真的需要dexify这个文件吗?第二:如果我必须对它进行dexify,那么我该如何摆脱上述错误?
增加我的堆大小,
我试过:java -Xmx4g
,但我得到了
Invalid maximum heap size: -Xmx4g
The specified size exceeds the maximum representable size.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
然后我尝试java -Xmx2g
了,但我得到了
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
所以我尝试了java -Xmx1g
,java -Xmx1100g
然后我得到了:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m
ore details.
在所有情况下,当我尝试对捆绑文件进行 dexify 时,我仍然会遇到相同的错误。我应该怎么办?我正在使用安装了 4.00 GB(可用 2.96 GB)的 Windows 32 位。