gluonhq / attach

GNU General Public License v3.0
50 stars 26 forks source link

Issue on Android opening URL in the browser #299

Closed FlorianKirmaier closed 2 years ago

FlorianKirmaier commented 2 years ago
03-25 20:51:48.326  4922  4962 D GraalCompiled: CreateCertificateSuccess(https://<domain>/<path>)
03-25 20:51:48.326  4922  4967 D GraalGluon: ATTACH_DALVIK, tid = 4967, existed? 1, dalvikEnv at 0x78852e8b50
03-25 20:51:48.335  4922  4967 E GluonAttach: There is no activity to handle the browser intent
03-25 20:51:48.335  4922  4967 D GraalGluon: DETACH_DALVIK, tid = 4967, existed = 1, env at 0x78852e8b50
03-25 20:51:48.335  4922  4962 D GraalCompiled: java.io.IOException: Error launching url https://<domain>/<path>
03-25 20:51:48.335  4922  4962 D GraalCompiled:     at com.gluonhq.attach.browser.impl.AndroidBrowserService.launchExternalBrowser(AndroidBrowserService.java:57)

I'm getting the following issue when trying the browser based on the API of attach. Any tips on what this means? "no browser intent" sounds to me like something someone would know, with some android experience.

Edit: Stackoverflow suggests, that the "http://" is missing in the URL, but it's correctly provided.

FlorianKirmaier commented 2 years ago

Push @johanvos @johanvos Any tips about it? Is there an android app available, with the latest attach/substrate version available, where the browser component worked? My latest working version was using quite old versions and SNAPSHOT builds.

jperedadnr commented 2 years ago

The Devoxx app uses the latest Attach BrowserService.

Code: https://github.com/devoxx/MyDevoxxGluon/tree/gluonfx

app: https://play.google.com/store/apps/details?id=com.devoxx

Using the service from the app shows this log:

GraalCompiled: Apr 12, 2022 6:54:29 PM com.gluonhq.attach.util.Services get
04-12 18:54:29.253  2463  3522 D GraalCompiled: FINE: Get Service com.gluonhq.attach.browser.BrowserService
04-12 18:54:29.253  2463  3522 D GraalCompiled: Apr 12, 2022 6:54:29 PM com.gluonhq.attach.util.Services get
04-12 18:54:29.253  2463  3522 D GraalCompiled: FINE: Return service: com.gluonhq.attach.browser.impl.AndroidBrowserService@5c1db2b2
04-12 18:54:29.253  2463  3549 D GraalGluon: ATTACH_DALVIK, tid = 3549, existed? 1, dalvikEnv at 0x7ec217a0c0
04-12 18:54:29.272   952  2988 I ActivityTaskManager: START u0 {act=android.intent.action.VIEW dat=https://devoxx.fr/... flg=0x10000000 cmp=com.android.chrome/com.google.android.apps.chrome.IntentDispatcher} from uid 10193
FlorianKirmaier commented 2 years ago

Ok, thank you for the info. Any other Ideas, in which directions the issue might be? I've updated Gradle and the gluon dependencies, from an old SNAPSHOT build. I've noticed that also the old font-awesome icons stopped working.

Any tips in which direction I can look?

jperedadnr commented 2 years ago

There are some issues with the GraalVM 22.0.0.3-Final/JDK 17 version. For now it's better to use GraalVM 22.0.0.2-Final/JDK 11 from https://github.com/gluonhq/graal/releases/tag/gluon-22.0.0.2-Final.

As for the BrowserService, not sure where CreateCertificateSuccess comes from. Also note the message in your log There is no activity to handle the browser intent, that is printed from here:

if (browserIntent.resolveActivity(activity.getPackageManager()) == null) {
            Log.e(TAG, "There is no activity to handle the browser intent");
            return false;
        }

so something might be wrong with your application package.

FlorianKirmaier commented 2 years ago

@jperedadnr @johanvos

I've been able to reinvestigate this issue, and now I'm sure it's not on my side! Sadly I don't know a way to solve the issue.

I've forked your hello-gluon-ci example and added the Attach Browser service to it. Even on that codebase, it doesn't work. You can download the APK in the latest github action run. (it's only red, because it couldn't upload it)

The last time, I guess I just worked around it, by not updating the App, which is now no longer an option.

I'm quite sure, it worked 1-2 years ago. Could you do me a favor and look into this again?

FlorianKirmaier commented 2 years ago

Some more notes:

New console output:

07-06 15:49:06.959  8247  8286 D GraalCompiled:  ########################### Link: https://openduke.com
07-06 15:49:06.959  8247  8296 D GraalGluon: ATTACH_DALVIK, tid = 8296, existed? 1, dalvikEnv at 0x74c2d85870
07-06 15:49:06.966  8247  8296 E GluonAttach: There is no activity to handle the browser intent
07-06 15:49:06.966  8247  8296 D GraalGluon: DETACH_DALVIK, tid = 8296, existed = 1, env at 0x74c2d85870
07-06 15:49:06.967  8247  8286 D GraalCompiled: java.io.IOException: Error launching url https://openduke.com
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.gluonhq.attach.browser.impl.AndroidBrowserService.launchExternalBrowser(AndroidBrowserService.java:57)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.gluonhq.hello.HelloGluonApp.lambda$init$1(HelloGluonApp.java:68)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
07-06 15:49:06.967  8247  8286 D GraalCompiled:     at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
jperedadnr commented 2 years ago

Can you try with Attach 4.0.15-SNAPSHOT? This PR https://github.com/gluonhq/attach/pull/309 should fix your issue.

You'll need:

<repository>
            <id>Snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
FlorianKirmaier commented 2 years ago

Nice, the HelloWorld seems to work. Let me quickly check the real application, then I will close the ticket.

Thank you very much for the super quick response!

FlorianKirmaier commented 2 years ago

The real application also works now without problems, thank you!