Android Question [Solved] Chrom Custom Tabs unable to run

mcqueccu

Well-Known Member
Licensed User
Longtime User
I kept getting this error with Chrom Custom Tabs...Any help?

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

mcqueccu

Well-Known Member
Licensed User
Longtime User
Hiding the code (your project) you are using is of NO HELP for us.
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

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

Attachments

  • chromtabserror.zip
    47.4 KB · Views: 328
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The library xml contains
B4X:
    <dependsOn>android-support-customtabs</dependsOn>
    <dependsOn>android-support-v4</dependsOn>
Both are wrong references.

Remove them and add
B4X:
#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.

Logger verbunden mit: 988ad036525346515630
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 348)
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-VZCDYwk8jEtMhixm-VR5UA==/base.apk)
at smm.customtabs.CustomTabs.chromeCustomTab(CustomTabs.java:84)
at b4a.example.cct.main._activity_create(main.java:348)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
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:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6940)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime 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...
 

Attachments

  • CCTV0.1.zip
    1.6 KB · Views: 356
  • website_cct.zip
    47.4 KB · Views: 358
  • src.zip
    1.3 KB · Views: 339
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime 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

B4X:
*** 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)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Almora

Well-Known Member
Licensed User
Longtime 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...

it works well.

Is it possible to open the website only in chrome browser?
 
Upvote 0

Almora

Well-Known Member
Licensed User
Longtime User
sample project opens yandex browser.
 

Attachments

  • Screenshot_2019-01-27-11-50-51.jpg
    Screenshot_2019-01-27-11-50-51.jpg
    368.6 KB · Views: 292
  • Screenshot_2019-01-27-11-50-33.jpg
    Screenshot_2019-01-27-11-50-33.jpg
    219.3 KB · Views: 281
Upvote 0
Top