Sergio
Sergio

Reputation: 768

ParseException in Android

I am triying this code

https://github.com/headius/dexclient/blob/master/src/DexClient.java

And I have in my main code the following code:

DexClient dxclient = new DexClient();
String[] name = { "/mnt/sdcard/HelloWorld.class" };
try {
    byte[] mybytes = getBytesFromFile(new File(name[0]));
    byte[][] bytes = {mybytes};
    dxclient.classesToDex(name, bytes);
}
catch(Exception e) {
    e.printStackTrace();
}

My HelloWorld Class is the following:

package mnt.sdcard;

public class HelloWorld {

    private String message;

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

}

But I have the next error:

WARN/System.err(298): com.android.dx.cf.iface.ParseException: 
    class name (mnt/sdcard/HelloWorld) does not match path 
    (/mnt/sdcard/HelloWorld.class)

Can someone help me?

Upvotes: 1

Views: 1469

Answers (1)

Sergio
Sergio

Reputation: 768

I solve this problem

I changed this:

String[] name={"/mnt/sdcard/HelloWorld.class"};

to this

String[] name={"mnt/sdcard/HelloWorld.class"};

Thanks :)

Upvotes: 2

Related Questions