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

Discussion in 'Libraries developers questions' started by DonManfred, Jan 25, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    Code:
    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
    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
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    This error means that the same class appears in two referenced jars.
     
  3. DonManfred

    DonManfred Expert Licensed User

    but i have no two jar referenced. Only one
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    This is what this error means. This is all that I can say.
     
  5. xiaoyao

    xiaoyao Member Licensed User

    java.lang.IllegalArgumentException: already added: Lcom/readystatesoftware/viewbadger/BadgeView;
    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?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    This means that both jars include the same class. You need to open one of the jars (with 7zip) and delete the duplicate class file.
     
  7. xiaoyao

    xiaoyao Member Licensed 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!
     
  8. xiaoyao

    xiaoyao Member Licensed 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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice