1. Check out our companion app, Forums for Android! Download from Google Play

Conversion to Dalvik format, error 1, blah blah...one cause/solution found!

Discussion in 'Application Development' started by GTbrewer, May 12, 2011.

  1. GTbrewer

    GTbrewer Well-Known Member
    Thread Starter

    Apr 25, 2011
    WAS Sr.. NetworkEngineer, then 16th Special Operat
    Fort Walton Beach, FL
    Sorry for the repost on this (I posted this same info at the end of
    another thread), but IMHO, this seems like a common-enough problem that I
    would really like to make sure this one cause/solution is seen by anyone
    looking for it.

    B Lyon, in the developers forum, deserves a billion thanks for a
    tremendous amount of assistance (first on the developers forum, then via
    direct e-mail....we had e-mails flying back and forth like crazy late
    last night and early this morning). Anyways, something from our
    conversations last night, that I didn't really process until a little
    while ago, hit me (like a lead brick).

    Ultimately, the problem traced back to a set of error messages indicating
    a few redundant classes in jtwitter.jar and android.jar. The were all
    under org/json (sound familiar?). I tried removing that part from
    jtwitter.jar, but of course, that only made things worse. Then, as I
    said, it hit me just a little while ago.

    I got out of Eclipse, opened up the .classpath file in vim, and saw what
    I hadn't really processed in my brain last night: jtwitter.jar was being
    loaded prior to android.jar (Eclipse did that, not me). Anyways, I
    reversed the two lines so android.jar was being loaded first, re-started
    Eclipse, and dd a "Build All". It built. ZERO errors. :)

    Now I just need to remember (or more like, try all three until I find the
    right one) which build method produces an SDK (or is that APK? whatever....)
    file. I already know that the Build All didn't, but I seem to recall that it
    didn't for the Hello Android app, either. Whatever. It'll take a minute or less
    to find that, so no worries there.

    So if you're seeing the error about the Conversion to Dalvik format
    failing with error 1, check your .classpath file, and your error
    messages, and look for dupes, or just something else loading before
    android.jar, and you might just have your solution right there.

    Hope this helps.....


    PS: And this time, I got it right...a new thread, instead of a new reply. :)
    As always, blame it on chemobrain, and 99^ of the time, it's true. Sigh....


  2. GTbrewer

    GTbrewer Well-Known Member
    Thread Starter

    Apr 25, 2011
    WAS Sr.. NetworkEngineer, then 16th Special Operat
    Fort Walton Beach, FL
    And then, on the second build, a NEW error decided to annoy the **** out of me....

    --------------------------- CUT HERE ---------------------------

    [2011-05-12 13:36:14 - Yamba] Dx
    trouble processing "java/nio/CharBuffer.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.

    [2011-05-12 13:36:14 - Yamba] Dx 1 error; aborting
    [2011-05-12 13:36:15 - Yamba] Conversion to Dalvik format failed with error 1

    --------------------------- CUT HERE ---------------------------


Share This Page