我刚刚将我的 Android SDK 更新为 r22。我知道更新存在一些问题,但它更侧重于 Eclipse 的 Android ADT。我今天已经绞尽脑汁想了一天的问题与充气城堡有关
我正在构建一个 PhoneGap 应用程序,在此更新之前一切都很好,但现在构建失败了。
我正在使用命令行构建应用程序(使用 /cordova 文件夹中 PhoneGap 提供的构建工具)。
我得到的错误是:
BUILD FAILED
/Users/rhystague/Development/mobile-dev/android-dev/android-sdk-macosx/tools/ant/build.xml:955: The following error occurred while executing this line:
/Users/rhystague/Development/mobile-dev/android-dev/android-sdk-macosx/tools/ant/build.xml:966: The following error occurred while executing this line:
/Users/rhystague/Development/mobile-dev/android-dev/android-sdk-macosx/tools/ant/build.xml:310: java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
在此之后,我得到了堆栈跟踪。我把它放在这个问题的底部。
这是我的环境和我尝试过的东西。
环境
Mac OS X 10.8.4
Java 1.6
Java 1.7
对于 Mac OS 10.8.4,java 安装位置不同。当我输入:
which java
I get :/usr/bin/java
java -version
1.6 Version
/usr/libexec/java_home
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Content/Home
To run the 1.7 version I have to go to it's home directly which is
/Library/Internet plugins/JavaAppletPlugin.plugin/Contents/Home
我发现这可能是我电脑上的一个库Bouncy Castle (bcprov-jdk15-143.jar) 的问题。我尝试了这些步骤,但我得到的只是 Java 的 ClassDefNotDefined 问题。
我尝试将文件移动到项目中的 libs 文件夹中,试图查看是否可以修复,但什么也没有。
我再次尝试将库更新到更新版本的 Bouncy Castle (bcprov-jdk15-on-149.jar),我得到的只是使用 java 的 ClassDefNotDefined。
我尝试了一个新的电话间隙应用程序,认为它可能与设置有关,但仍然是同样的问题。
老实说,我不是 Java 高手,所以我只知道基础知识。也许它很简单,或者它可能是别的东西。
无论哪种方式,我都阻止了我。我无法测试任何东西。
下面是从错误吐出之后的堆栈跟踪
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at org.apache.tools.ant.AntClassLoader.defineClassFromData(AntClassLoader.java:1128)
at org.apache.tools.ant.AntClassLoader.getClassFromStream(AntClassLoader.java:1299)
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1355)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.android.sdklib.build.ApkBuilder.init(ApkBuilder.java:446)
at com.android.sdklib.build.ApkBuilder.<init>(ApkBuilder.java:394)
at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:334)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)