dex fails placing debug info

by Michael Newton » Tue, 20 Apr 2010 13:08:24 GMT

Sponsored Links
  hope someone can offer some insight on this problem. My build was
failing with a dex error. After I turned verbosity up to debug I got
the following:

Buildfile: build.xml
[setup] Project Target: Android 1.6
[setup] API level: 4
[setup] WARNING: No minSdkVersion value set. Application will
install on all Android versions.


[echo] Converting compiled files and external libraries into /
[apply] trouble writing output:
[apply] shouldn't happen
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] Caused by: java.lang.RuntimeException: shouldn't happen
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] at
[apply] ... 8 more
[apply] ...while placing debug info for
[apply] ...while placing
[apply] ...while writing section 10

Here is the source of the class where it is failing to place debug
package com.sshtools.j2ssh.transport.publickey;

import com.sshtools.j2ssh.util.Hash;

public abstract class SshPublicKey {

public abstract String getAlgorithmName();

public abstract int getBitLength();

public abstract byte[] getEncoded();

public String getFingerprint() {
try {
Hash md5 = new Hash("MD5");

byte[] digest = md5.doFinal();
int bits = getBitLength();
bits = (((bits % 8) != 0) ? (bits += (bits % 8)) : bits);

String ret = String.valueOf(bits);

for (int i = 0; i < digest.length; i++) {
ret += (((i == 0) ? ":" : "") + " " +
Integer.toHexString(digest[i] & 0xFF));

return ret;
} catch (NoSuchAlgorithmException nsae) {
return null;


dex fails placing debug info

by Dan Bornstein » Wed, 21 Apr 2010 07:33:11 GMT

 On Mon, Apr 19, 2010 at 4:26 PM, Michael Newton

This looks like a bug in dx (the tool that turns .class files into
.dex files). Since compilers can produce different output for the same
source, it's much more interesting to see the compiled .class file
that is being processed.

Please file a bug by following the directions at
<> ;. Again, in this case,
attaching the .class file that fails is much better than just
including the source text.

As a workaround, you might try compiling without debugging info (that
is, removing "-g" from your javac command line). You might also try
splitting the failing method (getFingerPrint) in various places (e.g.,
put the try body in a separate method), as that will change the
emitted code and has a good chance of avoiding the problem.




Sponsored Links

dex fails placing debug info

by Michael Newton » Wed, 21 Apr 2010 23:26:17 GMT

 I fixed this - this code is where the problem is:

            int bits = getBitLength();
            bits = (((bits % 8) != 0) ? (bits += (bits % 8)) : bits);

When I assigned the result of the expression in the second line to a
new variable instead of back to int bits, the problem went away.

The clue was in 
- may be the same kind of issue.



dex fails placing debug info

by fadden » Fri, 23 Apr 2010 04:10:41 GMT


Can you attach the failing and non-failing .class files to that bug?


Other Threads

1. JSON easy Marshall/Unmarshall


We are working on an client / server application - and the design
goals for the communications framework are:

1. Low bandwidth
2. Low Latency
3. Scalable
4. Fast marshall/unmarshall

What sort of communications framework do you recommend?

We think json would do the trick, and we can use plain NIO socket
based communications for the least bandwidth - on the server side, we
can use something like Apache MINA or Netty.

Serialisation does not work properly on android <-> other system.

SOAP is just too heavy for communications, not to mention slow due to
the xml processing involved.

We've thought of using XStream as well, but we need a custom version
hacked by a forum member here (it works though).

So like I said, JSON is pure string based communications, and can also
be compressed for transfer.

The only issue we have is that something Google gson, which would have
been brilliant if it could be used on android to marshall/unmarshall
complex objects, doesn't work on android. Sure, we can use gson to
marshall/unmarshall on the server side, but we can't even begin to
think how we'd do that on android using the minimalistic builtin json
library for complex classes? Is there something available (Aside from
gson) that works on android, and that automatically marshalls/
unmarshalls json?  Let's say we have the following class:

class Foo {
   public int id;
   public ArrayList<Bar> bars  =  new ArrayList<Bar> ();

class Bar {
   public int x;
   public String name;
   public Set<String> references = new HashSet<String>(0);
   public ArrayList<Object> list = new ArrayList<Object> ();

The only other thing I can think of is plain socket/byte based
communications, and building the data structures painfully on the
client/server - just like in C.

Any thoughts??


2. my app sometimes take <1 second to load, sometimes 50 seconds

Hi all,

I'm pretty stumped here.

I've got an app that more or less follows the layout of LunarLander,
with an Activity, a View, and a Thread. The View extends SurfaceView
and the thread is what does the drawing. It is relatively light on
resources - 16 PNGs totalling 240KB, one simple layout xml, and one
simple values xml.

The load time for the app is all over the map. It sometimes loads in
under a second, sometimes it takes as much as 50 seconds. But as long
as I don't touch it, it *always* finishes loading eventually (if I try
to interact with it, I get the "isn't responding" window and have the
option to kill it.. though even then it will finish loading if I wait
long enough). The behavior is the same whether I'm running my code on
the emulator or an actual ADP1.

I've done a fair amount of logging to try to figure out what's going
on, but I'm not getting anywhere. My activity's onStart() is always
done in less than 2 seconds; my view and thread are also ready to go
within 2 seconds. Even my first call to onDraw() is always done in
under 3 seconds from the time the activity starts.

After all that is done, I'll be starting at a blank screen (with my
title bar) for a very arbitrary amount of time. Finally, the logcat
will show me:

I/ActivityManager( 52): Displayed activity 11301 ms
Of course, 11301 ms is sometimes 800ms, 3000ms, 20000ms, or 50000ms
instead. Unfortunately, until that line shows up, my app is
unresponsive and does not actually fill in the black space on the

I can't figure out what is going on in the time between when my app
seems to be saying it's completely ready and when android decides it's
ready to go. Has anyone else seen this? Does anyone else have any

3. Text animation question

4. Connecting a Google Dev phone to UK Vodafone

5. Tracking data/hiding things in a list

6. Map Example throwing class not found exception

7. Imageview and ArrayAdapter