我正在尝试使用Microsoft创建的SignarR client library。但是当我尝试运行[signalr-clent-test-integration-android]并将其加载到模拟器或设备中时,我得到以下错误。根据研究,我发现存在重叠的依赖性,并且由于某种原因,Java并不喜欢它。这里的依赖关系是[signalr-client-sdk-android]和[signalr-client-test-integration-base]库使用的[signalr-client-skd]库,它们被[signalr-clent-test-integration]使用-android] android app。
那么,请问有关如何解决这个问题的指导吗?不确定微软的人们是否甚至测试过这个测试应用程序。任何帮助/指导将不胜感激。
Executing tasks: [:signalr-client-test-integration-android:assembleDebug]
Configuration on demand is an incubating feature.
:signalr-client-test-integration-android:preBuild
:signalr-client-test-integration-android:compileDebugNdk
:signalr-client-sdk:compileJava UP-TO-DATE
:signalr-client-sdk:processResources UP-TO-DATE
:signalr-client-sdk:classes UP-TO-DATE
:signalr-client-sdk:jar UP-TO-DATE
:signalr-client-sdk-android:compileLint
:signalr-client-sdk-android:copyReleaseLint UP-TO-DATE
:signalr-client-sdk-android:preBuild
:signalr-client-sdk-android:preReleaseBuild
:signalr-client-sdk-android:checkReleaseManifest
:signalr-client-sdk-android:preDebugBuild
:signalr-client-sdk-android:preDebugTestBuild
:signalr-client-sdk-android:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:signalr-client-sdk-android:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:signalr-client-sdk-android:prepareReleaseDependencies
:signalr-client-sdk-android:compileReleaseAidl UP-TO-DATE
:signalr-client-sdk-android:compileReleaseRenderscript UP-TO-DATE
:signalr-client-sdk-android:generateReleaseBuildConfig UP-TO-DATE
:signalr-client-sdk-android:generateReleaseAssets UP-TO-DATE
:signalr-client-sdk-android:mergeReleaseAssets UP-TO-DATE
:signalr-client-sdk-android:generateReleaseResValues UP-TO-DATE
:signalr-client-sdk-android:generateReleaseResources UP-TO-DATE
:signalr-client-sdk-android:mergeReleaseResources UP-TO-DATE
:signalr-client-sdk-android:processReleaseManifest UP-TO-DATE
:signalr-client-sdk-android:processReleaseResources UP-TO-DATE
:signalr-client-sdk-android:generateReleaseSources UP-TO-DATE
:signalr-client-sdk-android:compileReleaseJava UP-TO-DATE
:signalr-client-sdk-android:extractReleaseAnnotations UP-TO-DATE
:signalr-client-sdk-android:mergeReleaseProguardFiles UP-TO-DATE
:signalr-client-sdk-android:processReleaseJavaRes UP-TO-DATE
:signalr-client-sdk-android:packageReleaseJar UP-TO-DATE
:signalr-client-sdk-android:compileReleaseNdk UP-TO-DATE
:signalr-client-sdk-android:packageReleaseJniLibs UP-TO-DATE
:signalr-client-sdk-android:packageReleaseLocalJar UP-TO-DATE
:signalr-client-sdk-android:packageReleaseRenderscript UP-TO-DATE
:signalr-client-sdk-android:packageReleaseResources UP-TO-DATE
:signalr-client-sdk-android:bundleRelease UP-TO-DATE
:signalr-client-test-integration-android:preDebugBuild
:signalr-client-test-integration-android:checkDebugManifest
:signalr-client-test-integration-android:preReleaseBuild
:signalr-client-test-integration-base:compileJava UP-TO-DATE
:signalr-client-test-integration-base:processResources UP-TO-DATE
:signalr-client-test-integration-base:classes UP-TO-DATE
:signalr-client-test-integration-base:jar UP-TO-DATE
:signalr-client-test-integration-android:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:signalr-client-test-integration-android:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:signalr-client-test-integration-android:prepareSignalRSignalrClientSdkAndroidUnspecifiedLibrary UP-TO-DATE
:signalr-client-test-integration-android:prepareDebugDependencies
:signalr-client-test-integration-android:compileDebugAidl UP-TO-DATE
:signalr-client-test-integration-android:compileDebugRenderscript UP-TO-DATE
:signalr-client-test-integration-android:generateDebugBuildConfig UP-TO-DATE
:signalr-client-test-integration-android:generateDebugAssets UP-TO-DATE
:signalr-client-test-integration-android:mergeDebugAssets UP-TO-DATE
:signalr-client-test-integration-android:generateDebugResValues UP-TO-DATE
:signalr-client-test-integration-android:generateDebugResources UP-TO-DATE
:signalr-client-test-integration-android:mergeDebugResources UP-TO-DATE
:signalr-client-test-integration-android:processDebugManifest UP-TO-DATE
:signalr-client-test-integration-android:processDebugResources UP-TO-DATE
:signalr-client-test-integration-android:generateDebugSources UP-TO-DATE
:signalr-client-test-integration-android:compileDebugJava
Note: C:\IM1\Device Projects\Android\SignalR\SignalR\signalr-client-test-integration-android\src\main\java\microsoft\aspnet\signalr\client\test\integration\android\MainActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:signalr-client-test-integration-android:preDexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing microsoft/aspnet/signalr/client/test/integration/ApplicationContext$1.class
1 error; aborting
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing microsoft/aspnet/signalr/client/Action.class
1 error; aborting
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':signalr-client-test-integration-android:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\adt-bundle\sdk\build-tools\21.1.2\dx.bat --dex --output C:\IM1\Device Projects\Android\SignalR\SignalR\signalr-client-test-integration-android\build\intermediates\pre-dexed\debug\signalr-client-sdk-22e3214ec8048293555e1dae6b0ea2a34310b794.jar C:\IM1\Device Projects\Android\SignalR\SignalR\signalr-client-sdk\build\libs\signalr-client-sdk.jar
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing microsoft/aspnet/signalr/client/Action.class
1 error; aborting
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.289 secs
答案 0 :(得分:1)
相关错误为bad class file magic (cafebabe) or version (0034.0000)
。版本0x34适用于java 8类,android目前不支持。
最好的办法是尝试使用java 1.7兼容性重建客户端jar。
答案 1 :(得分:0)
经过大量的谷歌搜索并将我的头撞在墙上后,我们终于弄明白了。这肯定与Java 8有关。因此,如果你有相互引用的库,你现在就不能在Android中使用Java 8。
此问题的解决方案不仅仅是告诉Android使用编译器到1.7或更早版本,而是在您的计算机上安装了1.7 JDK 并将JDK位置设置为指向它。这可以在[项目结构]下找到 - > [ SDK位置] - > [ JDK位置]。呼!!!
感谢我的同事在他的机器上安装了1.7和1.6的并行程序,并将JDK位置切换为1.7并且它正常工作!所以,我必须下载1.7.x JDK并将其安装在我的计算机上才能工作!这很荒谬但有效! :)
如果出现这种情况,默认设置中构建,执行,部署下的编译器设置是什么?