gpt4 book ai didi

android - android 上的 Jain SIP 堆栈提示核心类的错误使用

转载 作者:太空狗 更新时间:2023-10-29 12:49:52 25 4
gpt4 key购买 nike

我正在尝试在 android 上实现 JAIN sip 堆栈,但是当我尝试编译演示程序时出现此错误:

trouble processing "javax/sip/ClientTransaction.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.

If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.

If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.

If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.

[2012-11-11 22:27:28 - Jain-Test-and] Dx 1 error; aborting
[2012-11-11 22:27:28 - Jain-Test-and] Conversion to Dalvik format failed with error 1

是否可以在 eclipse 中向编译器添加 --core-library 参数,如果可以,我该怎么做,我可以向程序添加命令行选项,但不知道该怎么做它给编译器。另外,是否建议这样做,或者是否有其他解决方法?

最佳答案

JAIN jar 正在为其包使用 javax 命名空间。 Android 不允许在外部 jar 中使用核心库。所以你必须重新包装它们。您可以将此与 Ant 结合使用和 JarJar (如错误输出中所述)通过完成以下步骤:

在 build.xml 中添加此代码以重新打包 JAIN jar:

<target name="-jarjar" depends="compile">
<taskdef
name="jarjar"
classname="com.tonicsystems.jarjar.JarJarTask"
classpath="buildtools/jarjar-1.4.jar"/>

<jarjar jarfile="${out.absolute.dir}/jain-sip-sdp-repackaged.jar">
<fileset dir="${out.classes.absolute.dir}" />
<zipfileset src="libs/jain-sip-sdp-1.2.2014.jar" />
<rule pattern="javax.**" result="com.demo.@1"/>
<rule pattern="gov.nist.javax.**" result="com.demo.@1"/>
</jarjar>

<jarjar jarfile="${out.absolute.dir}/jain-sip-api-repackaged.jar">
<fileset dir="${out.classes.absolute.dir}" />
<zipfileset src="libs/jain-sip-api-1.2.jar" />
<rule pattern="javax.**" result="com.demo.@1"/>
</jarjar>

<jarjar jarfile="${out.absolute.dir}/jain-sip-ri-repackaged.jar">
<fileset dir="${out.classes.absolute.dir}" />
<zipfileset src="libs/jain-sip-ri-1.2.2014.jar" />
<rule pattern="gov.nist.javax.**" result="com.demo.@1"/>
</jarjar>

</target>

在命令行工具中调用 ant install。将新 jar 添加到您的构建路径并删除旧 jar 。

关于android - android 上的 Jain SIP 堆栈提示核心类的错误使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13335248/

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