Java Question java.lang.IllegalArgumentException: already added: Lcom/readystatesoftware/viewbadger/BadgeView;

DonManfred

Expert
Licensed User
Longtime User
B4X:
package de.donmanfred;

import com.readystatesoftware.viewbadger.BadgeView;

import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
@Version(0.02f)
@ShortName("Badger")
//@Permissions(values={"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE"})
//@Events(values={"ListTables(tables As List, ms as Long)"
//        ,"QueryResult(data as List, meta As Map)"
//        ,"QueryResult2(data as List, meta As Map)"
//        ,"BatchResult(batch As Map)"
//        ,"ExecResult(meta As Map)"})
@DependsOn(values={"android-viewbadger"})
public class Badger {
    private BA app;
    private String eventName;
    public void Initialize(final BA ba, String event){
        app = ba;
       eventName = event.toLowerCase(BA.cul);
    }
    public void AddBadge(final BA ba, View v, String value){
        BadgeView badge;
        badge = new BadgeView(ba.context , v);
        badge.setText(value);
        badge.setBadgePosition(BadgeView.POSITION_CENTER);
    v.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View arg0, MotionEvent arg1) {
                // TODO Auto-generated method stub
                return false;
            }
    });
    badge.show();
    }
}

When compiling a b4a project i get the error
Parsing code. 0.00
Compiling code. 0.02
Compiling layouts code. 0.00
Generating R file. 0.17
Compiling generated Java code. 0.71
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/readystatesoftware/viewbadger/BadgeView;
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.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
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)
1 error; aborting
Optimized dexer failed. Switching to Standard dexer.

It is an similar problem like i have with my pdfRenderer2-Library

To to the fact that this library is a short one i think i should start to fix this problem. :)

I´m using SLC 1.01 and B4A 4.0
 

Attachments

  • LibBadger.zip
    14.1 KB · Views: 326

xiaoyao

Active Member
Licensed User
Longtime User
java.lang.IllegalArgumentException: already added: Lcom/readystatesoftware/viewbadger/BadgeView;
This is what this error means. This is all that I can say.
WHEN I CREAT JAR FILE BY "LibraryCompiler.EXE",IF I USE TWO JAR IN MY B4A PROJECT,IT'S ERR,IF ONLY USE ONE JAR,IT'S GOOD,WHY?
 

xiaoyao

Active Member
Licensed User
Longtime User
NOT THIS QUESITON,I OPEN THE FOLDER ,AND DELETE MORE FILES IN \src\bin\classes\***
BECAUSE I COPY THE SAMPLE JAR PREJECT ,AND IT'S HAVE THE OLD CLASS . SO IT'S OK!
 

xiaoyao

Active Member
Licensed User
Longtime User
WHEN I write jar libraries,i can't find a small tool,i hope you can design a ide tool like "b4a",so i can write java code in your soft.
i only need the code like "
import java.io.File;
import android.content.Context;
import android.os.Environment;


public static void cleanDatabaseByName(Context context, String dbName) {
context.deleteDatabase(dbName);
}

if i write code like "context.", it will show more method let me select ,like context.deleteDatabase.
more times ,basic code like java ,only {} () not same ,and java have ";" in every line.

if a easy tool can write basic code same like java,it's very good?
it's b4j?
i want to put java code and quick use,if i learn b4j,it's need money to buy b4j,and it's hard,
i only want a easy ide to write java code,for create jar libraries ,to b4a use.
 
Top