Android Question B4A 6.80 UNEXPECTED TOP-LEVEL EXCEPTION

Discussion in 'Android Questions' started by Marko Druskovic, Mar 1, 2017.

  1. Marko Druskovic

    Marko Druskovic Member Licensed User

    Everything work ok in B4A < 6.80


    B4A version: 6.80
    Parsing code. (0.13s)
    Compiling code. (0.18s)
    Compiling layouts code. (0.04s)
    Organizing libraries. (0.00s)
    Generating R file. (0.54s)
    Compiling generated Java code. (2.13s)
    Convert byte code - optimized dex. Error
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout$1;
    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:615)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
    at com.android.dx.command.dexer.Main.access$2(Main.java:546)
    at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
    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:537)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
    at com.android.dx.command.dexer.Main.run(Main.java:206)
    at com.android.dx.command.dexer.Main.main(Main.java:179)
    at com.android.dx.command.Main.main(Main.java:103)
    1 error; aborting
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    You are using a library that mistakenly included okio.jar classes inside the library instead of adding a reference to the jar file or that references a different version of okio.

    Do a text search in the additional libraries folder and search for okio. What are the results?
     
  3. Marko Druskovic

    Marko Druskovic Member Licensed User

    Thank you Earl for fast answer. I found "okio-1.11.0.jar" and "okio-1.4.0.jar" in main "C:\Program Files (x86)\Anywhere Software\Basic4android\Libraries" folder. In additional libraries folder I don't have these files.

    When I try to delete it I get error:

    B4A version: 6.80
    Parsing code. (0.14s)
    Compiling code. (0.23s)
    Compiling layouts code. (0.04s)
    Organizing libraries. (0.00s)
    Generating R file. (0.59s)
    Compiling debugger engine code. (1.68s)
    Compiling generated Java code. Error
    Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\okio-1.11.0.jar
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    OkHttp references okio-1.11.0.

    Do a text search to find which library (xml) references okio-1.14.0
     
  5. Marko Druskovic

    Marko Druskovic Member Licensed User

    Earl, I'm not sure I get it right. (Picture in attach).
    In my project I use "OkHttp" and "AppUpdating"

    Thnx for helping
     

    Attached Files:

  6. Erel

    Erel Administrator Staff Member Licensed User

    Replace your file with the attached one and then clean the project (Ctrl + P) and test it.

    Edit: See post #8.
     
    Last edited: Mar 1, 2017
  7. Marko Druskovic

    Marko Druskovic Member Licensed User

    I did everything you said and still got this error: o_O
    I also try to uninstall B4A and install it again, but with no luck

    B4A version: 6.80
    Parsing code. (0.14s)
    Compiling code. (0.35s)
    Compiling layouts code. (0.06s)
    Organizing libraries. (0.98s)
    Generating R file. (0.55s)
    Compiling debugger engine code. (2.26s)
    Compiling generated Java code. (2.12s)
    Convert byte code - optimized dex. Error
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.IllegalArgumentException: already added: Lokio/AsyncTimeout$1;
    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:615)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:570)
    at com.android.dx.command.dexer.Main.access$2(Main.java:546)
    at com.android.dx.command.dexer.Main$2.processFileBytes(Main.java:514)
    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:537)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:449)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:236)
    at com.android.dx.command.dexer.Main.run(Main.java:206)
    at com.android.dx.command.dexer.Main.main(Main.java:179)
    at com.android.dx.command.Main.main(Main.java:103)
    1 error; aborting
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    I'm able to use OkHttpUtils2 together with AppUploading with the attached xml (make sure to clean the project after you update). It is a different one.

    If it doesn't work for you then create a new project and add the libraries until you find the problematic one.
     

    Attached Files:

  9. Marko Druskovic

    Marko Druskovic Member Licensed User

    Now it's working !!!!
    Erel you are the best!!! ;)

    Thnx again
     
    Erel likes this.
  10. udg

    udg Expert Licensed User

    Hi Erel,

    since I originally wrote AppUpdating, what am I expected to do about it to avoid such a problem? Thanks.

    udg
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    You did everything right.

    OkHttp native library was updated in this version (it is a major update). Your library referenced the older native libraries. What I did, is I deleted the references to these libraries from the XML file.

    You have two options:
    1. Manually delete these two lines from the XML:
    Code:
    <dependsOn>okhttp-2.4.0</dependsOn>
      <dependsOn>okio-
    1.1.0</dependsOn>
    And tell developers to add a reference to OkHttp in the libraries list.
    This way it will be supported by all versions.

    2. Compile your library with B4A v6.80. The result XML will be compatible with v6.80+ (until OKHttp native libraries are updated again).
     
  12. udg

    udg Expert Licensed User

    Since source code is provided I guess that options 2 will be better for those looking for a ready-made solution, expecially for those that didn't download the lib in the past.
    Will update it as soon as BA680 is installed.
    Thank you for your explanation.

    udg
     
  13. techknight

    techknight Well-Known Member Licensed User

    Still awaiting for your AppUpdating fix. I cant upgrade to 6.80 yet as all my apps depend on it, and library editing/compiling is still relatively scary to me at this point.
     
  14. techknight

    techknight Well-Known Member Licensed User

    I performed your suggestion erel with the AppUpdating xml, and it now crashes with this:

    java.lang.NoSuchMethodError: anywheresoftware.b4a.keywords.Common.ToastMessageShow
    at eu.dgconsulting.appupdating.cl_appupdate._jobdone(cl_appupdate.java:469)

    I assume I will need to start another thread on that.
     
  15. udg

    udg Expert Licensed User

    Hi @techknight , since I'm in the final stage of a product release I can't install B4A 6.80 yet, but @DonManfred was so kind to compile AppUpdating with it and attach it to post #243 of the lib's thread so you don't have to wait for me.
    Btw, you can compile the lib yourself since source is provided in post #1.

    udg
     
    DonManfred likes this.
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