0

I have only java version 1.8.0_45 (jdk1.8.0_45). So, your suggested solution's not solve my problem.

When I Run the app it throws the following errors:

UNEXPECTED TOP-LEVEL EXCEPTION: Error: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.parseClass(Main.java:764) at com.android.dx.command.dexer.Main.access$1500(Main.java:85) at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684) at com.android.dx.command.dexer.Main.processClass(Main.java:749) ... 12 more 1 error; aborting Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 1

Here is the my dependencies:

dependencies {
//    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services-appindexing:8.3.0'
    compile files('libs/signalr-client-sdk.jar')
    compile files('libs/signalr-client-sdk-android-release.jar')
}

I also tried to add the signalr-client-sdk-android-release lib as .aar file. But the result's same.

So, why this exception throws? And how can I solve problem for this project?

Thanks.

Mirjalal
  • 1,292
  • 1
  • 17
  • 40
  • 2
    how is this not a dupe? http://stackoverflow.com/questions/24662801/bad-class-file-magic-or-version – Marc B Dec 01 '15 at 21:08
  • @MarcB thanks for your quick response. But result is same. I also tried it before. – Mirjalal Dec 01 '15 at 21:11
  • Try using jar files in my GitHub sample project https://github.com/ngocchung/SimpleSignalRClient/tree/master/app/libs to see if it can help or not – BNK Dec 02 '15 at 01:15

1 Answers1

0

The signalr-client-sdk.jar causes this exception. So, these steps solved my problem:

  1. Created new project
  2. Imported (.java) source files of signalr-client-sdk from its folder (link to files).
  3. Imported signalr-client-sdk-android-release.aar as module.
  4. DON'T CHANGE any configuration in build.gradle files.

That's it.

Thank you.

Mirjalal
  • 1,292
  • 1
  • 17
  • 40