Android Question [SOLVED] Help interpreting this error....

Discussion in 'Android Questions' started by Cableguy, Jun 9, 2015.

  1. Cableguy

    Cableguy Expert Licensed User

    So I created another Class/Lib... Compiled it with no issues...
    During development, just about 95% in the class development, I did it in an ongoing project, and then loaded the class in a blank project in order to trouble shoot and do the finishing touches... all done.
    Then I went back to my ongoing project, and deleted the class, and selected my newly created lib...
    Tried to compile the project and.... BUM!!

    Code:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.IllegalArgumentException: already added: Lb4a/example/cgcolorpicker$_colorpalette;
        at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:
    122)
        at com.android.dx.dex.file.DexFile.add(DexFile.java:
    161)
        at com.android.dx.command.dexer.Main.processClass(Main.java:
    732)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:
    673)
        at com.android.dx.command.dexer.Main.access$
    300(Main.java:83)
        at com.android.dx.command.dexer.Main$
    1.processFileBytes(Main.java:602)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    170)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:
    229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    158)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:
    229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    158)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:
    229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    158)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:
    144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:
    632)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:
    510)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:
    280)
        at com.android.dx.command.dexer.Main.run(Main.java:
    246)
        at com.android.dx.command.dexer.Main.main(Main.java:
    215)
        at com.android.dx.command.Main.main(Main.java:
    106)
    UNEXPECTED TOP-LEVEL 
    EXCEPTION:
    java.lang.IllegalArgumentException: already added: Lb4a/example/cgcolorpicker;
        at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:
    122)
        at com.android.dx.dex.file.DexFile.add(DexFile.java:
    161)
        at com.android.dx.command.dexer.Main.processClass(Main.java:
    732)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:
    673)
        at com.android.dx.command.dexer.Main.access$
    300(Main.java:83)
        at com.android.dx.command.dexer.Main$
    1.processFileBytes(Main.java:602)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    170)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:
    229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    158)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:
    229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    158)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:
    229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
    158)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:
    144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:
    632)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:
    510)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:
    280)
        at com.android.dx.command.dexer.Main.run(Main.java:
    246)
        at com.android.dx.command.dexer.Main.main(Main.java:
    215)
        at com.android.dx.command.Main.main(Main.java:
    106)
    2 errors; aborting
    This is the resulting compilation LOG... I tried to delete the class file from the ongoing project folder, but that didn't help...

    [EDIT] Using the LIB in a new blank project gives no errors and works as intended
     
    Last edited: Jun 9, 2015
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Oh hell it's not my color picker giving you grief is it :p
    Have you tried the 'Clean Project' menu option? I think it's located under the Tools menu (not at my pc at the moment to be able to check). Whenever I have a strange problem where something was working but then stops working for no clear reason, it's the first thing I try. No idea what it actually does in the background though :rolleyes:
     
  3. walterf25

    walterf25 Well-Known Member Licensed User

    This error means you are using the same class in one library that another library already contains!

    Are you writing your own library?

    Walter
     
  4. Cableguy

    Cableguy Expert Licensed User

    That's what I 'read' too, but I removed and deleted the class from the project. Only the lib now exists in this project. I think it has to do with the rest folder, will look into it later
     
  5. Cableguy

    Cableguy Expert Licensed User

    After a deeper search I realized that every time I tried to run my project, the module I turned into a lib was being (re)saved, so I kept deleting it...
    Seems that clicking the 'X' on the tab does not remove the module, only hides it. lesson learnt. It would be nice if we could choose the default 'X' behaviour thou
     
Loading...