Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: When running on Android N+ without Chrome installed, WebView version check always fails #7678

Open
1 of 3 tasks
hbordersTwitch opened this issue Sep 25, 2024 · 0 comments
Labels

Comments

@hbordersTwitch
Copy link

hbordersTwitch commented Sep 25, 2024

Capacitor Version

[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted.
💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.1.1
@capacitor/core: 6.1.1
@capacitor/android: 6.1.1
@capacitor/ios: 6.1.1

Installed Dependencies:

@capacitor/cli: 6.1.1
@capacitor/ios: 6.1.1
@capacitor/android: 6.1.1
@capacitor/core: 6.1.1

[success] iOS looking great! 👌
[success] Android looking great! 👌

Other API Details

$ npm --version
10.7.0
$ node --version
v22.2.0
$ pod --version
1.15.2

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

I'm running on an Android API 24 Emulator without Chrome installed.

This code is failing:

        // Otherwise manually check WebView versions
        try {
            String webViewPackage = "com.google.android.webview";
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                webViewPackage = "com.android.chrome";
            }
            PackageInfo info = InternalUtils.getPackageInfo(pm, webViewPackage);
            String majorVersionStr = info.versionName.split("\\.")[0];
            int majorVersion = Integer.parseInt(majorVersionStr);
            return majorVersion >= config.getMinWebViewVersion();
        } catch (Exception ex) {
            Logger.warn("Unable to get package info for 'com.google.android.webview'" + ex.toString());
        }

Because InternalUtils.getPackageInfo(pm, webViewPackage) throws a NameNotFoundException because com.android.chrome is not installed.

The code should instead fall back to com.google.android.webview if com.android.chrome is not installed.

Installed package list ``` com.android.smoketest com.android.cts.priv.ctsshim com.google.android.youtube com.google.android.ext.services com.example.android.livecubes com.android.providers.telephony com.android.providers.calendar com.android.providers.media com.google.android.onetimeinitializer com.google.android.ext.shared com.android.protips com.android.documentsui com.android.externalstorage com.android.htmlviewer com.android.quicksearchbox com.android.mms.service com.android.providers.downloads com.google.android.apps.messaging com.google.android.configupdater com.android.defcontainer com.android.providers.downloads.ui com.android.vending com.android.pacprocessor com.android.certinstaller com.android.carrierconfig android com.android.contacts com.android.camera2 com.android.egg om.android.mtp com.android.launcher3 com.android.backupconfirm com.google.android.deskclock com.android.statementservice com.google.android.gm com.google.android.setupwizard com.android.providers.settings com.android.sharedstoragebackup om.google.android.music om.android.printspooler com.android.dreams.basic com.android.inputdevices com.android.sdksetup com.google.android.apps.maps com.android.cellbroadcastreceiver com.google.android.webview com.android.server.telecom com.google.android.syncadapters.contacts com.android.keychain com.android.dialer com.android.gallery3d com.google.android.packageinstaller com.android.emulator.smoketests com.google.android.gms com.google.android.gsf com.google.android.partnersetup com.svox.pico com.example.android.apis com.android.proxyhandler om.android.fallback com.android.inputmethod.latin org.chromium.webview_shell com.google.android.feedback com.google.android.printservice.recommendation com.google.android.apps.photos com.google.android.calendar om.android.managedprovisioning com.google.android.gsf.login com.android.wallpaper.livepicker com.android.netspeed com.google.android.backuptransport jp.co.omronsoft.openwnn com.android.bookmarkprovider com.android.settings com.android.calculator2 com.android.gesture.builder om.android.cts.ctsshim com.android.vpndialogs com.google.android.talk com.android.phone com.android.shell com.android.wallpaperbackup om.android.providers.blockednumber com.android.providers.userdictionary com.android.emergency com.android.location.fused com.android.systemui com.android.smoketest.tests com.android.customlocale2 com.example.android.softkeyboard com.android.development com.example.my_capacitor_app com.android.providers.contacts com.android.captiveportallogin com.android.widgetpreview ```

Expected Behavior

Capacitor loads when running on an Android without Chrome installed, but with a recent enough com.google.android.webview package.

Project Reproduction

Reproducing requires using a specific emulator

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant