2

I was hoping you guys can maybe help me with this issue. I keep getting this error when running the sample videochat from here. I tried downloading the zip file , clone and downloading only the sdk jar but i always get the same error, mentioned in the question. i searched SO and most of the solutions are build with java 1.6 which i'm already using (never installed later version), also some solutions found on google weren't helpful as well. saw this answer: (here)

For others searching for this error message, another possible cause is that you
are including libraries that were built for java 7. For us, adjusting those
builds to specifically target java 6 (and then building new jars) fixed the 
problem.

and i was thinking maybe this could be the problem, if so how can i get around it??? i would appreciate any help. thanks in advance

EDIT:

i was getting the Dx bad class... error for every class in the sdk jar file. after a lot more searching i stumbled upon an older version of the sdk jar file here and i was able to run this other sample with the earlier sdk version. only for some reason there is an important class missing from this file so naturally the sample crashes when i try to make a call (but it RUNS till that point with no errors).

so in-light of this can i assume everything is ok on my end and perhaps there is some problem with the sdk jar file? or is there anything i can do to fix it?

Community
  • 1
  • 1
user2717267
  • 290
  • 3
  • 10

4 Answers4

8

The correct answer is the following:

Since revision 19, you can compile your android project with any SDK (1.6, 1.7).

The following error occured, for me, when I set the Android SDK to 19 (that support java 7), but the build tools is not 19.x.

When you compile, have a look at which dx.jar it used (/xxx/android-sdk/build-tools/19.0.3/lib/dx.jar) and it should do the trick! Simply download the correct one with Android SDK Manager.

TheOnlyYam
  • 193
  • 2
  • 4
  • Hi @TheOnlyYam I know this answer is more than a year old but how does one check which dx.jar is used? I am building through Cordova on the command line and that info is not printed to console. Any other way? – TheLoy May 13 '15 at 07:40
  • ..also I have all the latest build-tool versions already installed from 19.0.1 to 21.1.2, shouldn't it just use the latest one? – TheLoy May 13 '15 at 07:50
  • @kingLoosh I added answer of mine explaining over the substitution. – Boris Strandjev Jun 14 '15 at 12:48
2

downloading the up-to-date IDE solved the problem

EDIT: I downloaded the latest eclipse + ADT bundle from here. also i updated my java JDK to Java SE 7u45.

  • make sure the project compiler setting is still set to 1.6 (should be default setting)

that solved the original error message but than i got something new: Dx warning: Ignoring InnerClasses attribute for an anonymous inner class...

I was told the issue should be fixed in the nearest time.

user2717267
  • 290
  • 3
  • 10
0

I've faced this error message during jar -> dex conversion. The problem was in a corrupted jar file.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
0

For me the problem was exactly with Build tools version as metnioned in @TheOnlyYam answer. I am using ADT. The way I resolved the issue:

  • I downloaded the latest version of the build tools from Android SDK manager
  • Still it was not used and the error persisted. So I added the line sdk.buildtools=22.0.1 in the project.propertiesfiles in all my projects and libraries. Now the error is gone.

PS: The only drawback being that I hardcoded the version and in future updates I will not automatically use it.

Community
  • 1
  • 1
Boris Strandjev
  • 46,145
  • 15
  • 108
  • 135