Android Question [Solved] Chrom Custom Tabs unable to run

Discussion in 'Android Questions' started by mcqueccu, Jun 4, 2018.

  1. mcqueccu

    mcqueccu Active Member Licensed User

    I kept getting this error with Chrom Custom Tabs...Any help?

    Code:
    B4A Version: 8.00
    Parsing code.    (
    0.03s)
    Compiling code.    (
    3.23s)
    Compiling layouts code.    (
    0.03s)
    Organizing libraries.    (
    14.75s)
    Generating R 
    file.    (5.58s)
    Compiling generated Java code.    (
    8.89s)
    Convert byte code - optimized dex.    Error
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsCallback;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsClient;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsClient$
    1;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsIntent;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsIntent$
    1;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsIntent$Builder;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsService;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsService$
    1;
    Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/customtabs/CustomTabsService$
    1$1;
    UNEXPECTED TOP-LEVEL 
    EXCEPTION:
    java.lang.RuntimeException: Translation has been interrupted
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:
    689)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:
    313)
        at com.android.dx.command.dexer.Main.run(Main.java:
    279)
        at com.android.dx.command.dexer.Main.main(Main.java:
    247)
        at com.android.dx.command.Main.main(Main.java:
    106)
    Caused by: java.lang.InterruptedException: Too many errors
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:
    681)
        ... 
    4 more
     
  2. DonManfred

    DonManfred Expert Licensed User

    Hiding the code (your project) you are using is of NO HELP for us.
     
  3. mcqueccu

    mcqueccu Active Member Licensed User

    sorry, It was part of a bigger project I thought what i posted contains enough information. here is my code. I have also attached sample project.

    When I add just the custom chrom tabs, it works, but when i add my other libraries, then i get that error

    Other Libraries
    ChromTabs
    DateUtils
    Javaobject
    Json
    okhttputils2
    Phone
    XUI

    Code:
    Dim cb As ChromCustomTabs
        cb.Initialize(
    "cb")
        cb.chromeCustomTab(
    "https://www.leafecodes.com/")
     

    Attached Files:

  4. DonManfred

    DonManfred Expert Licensed User

    One of the libs are already using
    Code:
    #AdditionalJar: com.android.support:support-v4
    Add the other libs and remove this line
     
  5. mcqueccu

    mcqueccu Active Member Licensed User

    I removed that line but the problem persist, but when i removed the firebaseAdmob lib, the app runs fine, What can i do to make both the chrom custom tabs and firebaseAdmob to run together?
     
  6. DonManfred

    DonManfred Expert Licensed User

    The library xml contains
    Code:
    <dependsOn>android-support-customtabs</dependsOn>
        <dependsOn>android-support-v4</dependsOn>
    Both are wrong references.

    Remove them and add
    Code:
    #AdditionalJar: com.android.support:support-v4
    #AdditionalJar: com.android.support:customtabs
    to you main activity.

    This let´s you successfully compile. But it then raises an error due to an unavailable method.

    Seems to me the CustomTabs library (the one from Google) has changed and the wrapper needs a rework too.

     
  7. DonManfred

    DonManfred Expert Licensed User

    Attached you find an - incomplete! - new wrap... It just create the builder and call the customtabs.
    There is no callback as of now... I´ll update it later this week. Today i just used 5 Minutes to write this one just to test... I was using the newest SDK Components...
     

    Attached Files:

    Almora and Kwame Twum like this.
  8. mcqueccu

    mcqueccu Active Member Licensed User

    Thank you for the new wrap. It Works fine now. Thank you very much

    Feedback on the old one
    When I remove the dependson lines from the xml and added the two additional jars, I got this error

    Code:
    *** Service (starter) Create ***
    ** 
    Service (starter) Start **
    ** 
    Activity (main) Create, isFirst = true **
    main_activity_create (java line: 
    345)
    java.lang.NoSuchMethodError: No virtual method launchUrl(Landroid/app/
    Activity;Landroid/net/Uri;)V in class Landroid/support/customtabs/CustomTabsIntent; or its super classes (declaration of 'android.support.customtabs.CustomTabsIntent' appears in /data/app/b4a.example.cct-1/base.apk)
        at smm.customtabs.CustomTabs.chromeCustomTab(CustomTabs.java:84)
        at b4a.example.cct.main._activity_create(main.java:
    345)
        at java.lang.reflect.Method.invoke(Native Method)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:
    186)
        at b4a.example.cct.main.afterFirstLayout(main.java:
    104)
        at b4a.example.cct.main.access$
    000(main.java:17)
        at b4a.example.cct.main$WaitForLayout.run(main.java:
    82)
        at android.os.Handler.handleCallback(Handler.java:
    836)
        at android.os.Handler.dispatchMessage(Handler.java:
    103)
        at android.os.Looper.loop(Looper.java:
    203)
        at android.app.ActivityThread.main(ActivityThread.java:
    6251)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    1075)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    936)
     
  9. DonManfred

    DonManfred Expert Licensed User

    that´s what i wrote above
     
    mcqueccu likes this.
  10. Almora

    Almora Active Member Licensed User

    it works well.

    Is it possible to open the website only in chrome browser?
     
  11. DonManfred

    DonManfred Expert Licensed User

    I think yes. The Lib is using the ChromeCustomTabs library. Based on its name i would think it only works with Chrome.
     
  12. Almora

    Almora Active Member Licensed User

    sample project opens yandex browser.
     

    Attached Files:

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