crwebview icon indicating copy to clipboard operation
crwebview copied to clipboard

Your example app not loading the extension.

Open hostingvosting opened this issue 2 years ago • 9 comments

Your example app not loading the extension. Please create an example app that load an extension because you example extension that is skyblue is also not loading.

i have change only the path mBrowserContext.loadExtension(getObbDir().getAbsolutePath());

I/.mask.crwebvie: Late-enabling -Xcheck:jni E/.mask.crwebvie: Unknown bits set in runtime_flags: 0x8000 I/Perf: Connecting to perf service. I/FeatureParser: can't find beryllium.xml in assets/device_features/,it may be in /system/etc/device_features W/.mask.crwebview: type=1400 audit(0.0:8976875): avc: denied { read } for name="u:object_r:vendor_displayfeature_prop:s0" dev="tmpfs" ino=14058 scontext=u:r:untrusted_app:s0:c175,c260,c512,c768 tcontext=u:object_r:vendor_displayfeature_prop:s0 tclass=file permissive=0 E/libc: Access denied finding property "ro.vendor.df.effect.conflict" W/Looper: Slow Looper main: Long Msg: seq=2 plan=01:33:47.261 late=2ms wall=1617ms running=1512ms runnable=19ms h=android.app.ActivityThread$H w=110 E/Perf: Fail to get file list io.mask.crwebview E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.mask.crwebview activity: io.mask.crwebview.AwShellActivity@1ebb27a I/chatty: uid=11199(io.mask.crwebview) identical 4 lines D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.mask.crwebview activity: io.mask.crwebview.AwShellActivity@1ebb27a D/cr_BrowserStartup: [BrowserStartupControllerImpl.java:435] Initializing chromium process, singleProcess=true I/cr_LibraryLoader: Successfully loaded native library I/cr_CachingUmaRecorder: Flushed 4 samples from 4 histograms. W/chromium: [WARNING:resource_bundle_android.cc(77)] failed to load locale.pak W/chromium: [WARNING:aw_resource_bundle.cc(30)] Failed to load locale .pak from apk. E/chromium: [ERROR:rtl.cc(147)] Failed to set the ICU default locale to . Falling back to en-US. V/cr_ClankAccessibility: [BrowserAccessibilityState.java:249] Enabled accessibility services list updated. I/chromium: [INFO:shell_extension_system.cc(38)] ShellExtensionSystem ShellExtensionSystem /data/user/0/io.mask.crwebview/app_webview/Default E/chromium: [ERROR:simple_file_enumerator.cc(21)] opendir /data/user/0/io.mask.crwebview/cache/WebView/Default/HTTP Cache/Code Cache/js: No such file or directory (2) E/chromium: [ERROR:simple_index_file.cc(614)] Could not reconstruct index from disk I/chromium: [INFO:aw_browser_context.cc(551)] AwBrowserContext InitExtensionSystem extension_system_ 0x7a000366c0 D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.mask.crwebview activity: io.mask.crwebview.AwShellActivity@1ebb27a I/chatty: uid=11199(io.mask.crwebview) identical 1 line D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.mask.crwebview activity: io.mask.crwebview.AwShellActivity@1ebb27a W/chromium: [WARNING:shell_extension_loader.cc(51)] Warnings loading extension at /storage/emulated/0/Android/obb/io.mask.crwebview: W/chromium: [WARNING:shell_extension_loader.cc(54)] Unrecognized manifest key 'author'. W/chromium: [WARNING:shell_extension_loader.cc(54)] Unrecognized manifest key 'browser_action'. W/chromium: [WARNING:shell_extension_loader.cc(54)] Unrecognized manifest key 'commands'. W/chromium: [WARNING:shell_extension_loader.cc(54)] Unrecognized manifest key 'minimum_chrome_version'. W/chromium: [WARNING:shell_extension_loader.cc(54)] Unrecognized manifest key 'short_name'. W/chromium: [WARNING:shell_extension_loader.cc(54)] Unrecognized manifest key 'storage'. W/chromium: [WARNING:shell_extension_loader.cc(54)] Manifest version 2 is deprecated, and support will be removed in 2023. See https://developer.chrome.com/blog/mv2-transition/ for more details. W/chromium: [WARNING:shell_extension_loader.cc(54)] Permission 'contextMenus' is unknown or URL pattern is malformed. W/chromium: [WARNING:shell_extension_loader.cc(54)] Permission 'privacy' is unknown or URL pattern is malformed. W/chromium: [WARNING:shell_extension_loader.cc(54)] Permission 'tabs' is unknown or URL pattern is malformed. W/chromium: [WARNING:shell_extension_loader.cc(54)] Permission 'webNavigation' is unknown or URL pattern is malformed. I/chromium: [INFO:aw_content_browser_client.cc(351)] AwContentBrowserClient OnWebContentsCreated 0x7a001a0000 I/chromium: [INFO:shell_extension_host_delegate.cc(19)] ShellExtensionHostDelegate OnExtensionHostCreated I/chromium: [INFO:shell_extension_system.cc(175)] ExtensionService content_verifier return nullptr I/chromium: [INFO:aw_browser_context.cc(577)] AwBrowserContext LoadExtension /storage/emulated/0/Android/obb/io.mask.crwebview ID:pkdpohcofjjegcaecmjgacbcmjdlilfe I/chromium: [INFO:aw_content_browser_client.cc(351)] AwContentBrowserClient OnWebContentsCreated 0x7a001a0c00 W/chromium: [WARNING:resource_bundle.cc(1154)] locale resources are not loaded W/chromium: [WARNING:resource_bundle.cc(1154)] locale resources are not loaded

hostingvosting avatar Aug 18 '23 20:08 hostingvosting

you should push the extension to /data/local/tmp/

wuruxu avatar Aug 19 '23 07:08 wuruxu

you should push the extension to /data/local/tmp/

sir i have copied the extension but it still E/chromium: [ERROR:shell_extension_loader.cc(33)] Extension directory not found: /data/local/tmp/ublock/

i have extension in my assets folder and i copy the folder into /data/local/tmp/ublock/

here is my code that copy the folder.

    public static void copyFolder(Context context, String folderName) {

    // Get the asset manager
    AssetManager assetManager = context.getAssets();

    // Get the list of files and folders in the assets folder
    String[] files = null;
    try {
        files = assetManager.list(folderName);
    } catch (IOException e) {
        Log.e("CopyAssetsFolder", "Failed to get asset file list.", e);
    }

    // Create the target folder
    File targetFolder = new File(Environment.getExternalStorageDirectory() + "/data/local/tmp/" + folderName);

    if (!targetFolder.exists()) {
        targetFolder.mkdirs();
    }

    // Copy the files and folders to the target folder
    for (String filename : files) {
        InputStream in = null;
        OutputStream out = null;

        try {
            String fullPath = folderName + "/" + filename;
            if (assetManager.list(fullPath).length > 0) {
                // It's a subfolder, so recursively call copyFolder
                copyFolder(context, fullPath);
            } else {
                // It's a file, so copy it
                in = assetManager.open(fullPath);
                out = new FileOutputStream(targetFolder + "/" + filename);

                // Copy the file
                byte[] buffer = new byte[1024];
                int bytesRead;
                while ((bytesRead = in.read(buffer)) != -1) {
                    out.write(buffer, 0, bytesRead);
                }
            }
        } catch (IOException e) {
            Log.e("CopyAssetsFolder", "Failed to copy file.", e);
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    // Ignore
                }
            }

            if (out != null) {
                try {
                    out.close();
                } catch (IOException e) {
                    // Ignore
                }
            }
        }
    }
}`

IamSZaidH avatar Aug 23 '23 15:08 IamSZaidH

you should modify the code to modify to load extension '/data/local/tmp/ublock/'

On Wed, 23 Aug 2023 at 23:48, iamz @.***> wrote:

you should push the extension to /data/local/tmp/

sir i have copied the extension but it still E/chromium: [ERROR:shell_extension_loader.cc(33)] Extension directory not found: /data/local/tmp/ublock/

i have extension in my assets folder and i copy the folder into /data/local/tmp/ublock/

here is my code that copy the data. `public static void copyFolder(Context context, String folderName) {

// Get the asset manager
AssetManager assetManager = context.getAssets();

// Get the list of files and folders in the assets folder
String[] files = null;
try {
    files = assetManager.list(folderName);
} catch (IOException e) {
    Log.e("CopyAssetsFolder", "Failed to get asset file list.", e);
}

// Create the target folder
File targetFolder = new File(Environment.getExternalStorageDirectory() + "/data/local/tmp/" + folderName);

if (!targetFolder.exists()) {
    targetFolder.mkdirs();
}

// Copy the files and folders to the target folder
for (String filename : files) {
    InputStream in = null;
    OutputStream out = null;

    try {
        String fullPath = folderName + "/" + filename;
        if (assetManager.list(fullPath).length > 0) {
            // It's a subfolder, so recursively call copyFolder
            copyFolder(context, fullPath);
        } else {
            // It's a file, so copy it
            in = assetManager.open(fullPath);
            out = new FileOutputStream(targetFolder + "/" + filename);

            // Copy the file
            byte[] buffer = new byte[1024];
            int bytesRead;
            while ((bytesRead = in.read(buffer)) != -1) {
                out.write(buffer, 0, bytesRead);
            }
        }
    } catch (IOException e) {
        Log.e("CopyAssetsFolder", "Failed to copy file.", e);
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException e) {
                // Ignore
            }
        }

        if (out != null) {
            try {
                out.close();
            } catch (IOException e) {
                // Ignore
            }
        }
    }
}

}`

— Reply to this email directly, view it on GitHub https://github.com/wuruxu/crwebview/issues/4#issuecomment-1690206494, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITL57MB2C2EVDGBXU26VLXWYQ3BANCNFSM6AAAAAA3V62LDU . You are receiving this because you commented.Message ID: @.***>

-- Thanks PGP Fingerprint: F7BA D6CE 6592 77C7 0D2E 3BD5 5479 A15E B305 B8FE

wuruxu avatar Aug 24 '23 13:08 wuruxu

i have same issue

chromium                io.mask.crwebview                    W  [WARNING:resource_bundle_android.cc(77)] failed to load locale.pak
chromium                io.mask.crwebview                    W  [WARNING:aw_resource_bundle.cc(30)] Failed to load locale .pak from apk.
chromium                io.mask.crwebview                    E  [ERROR:rtl.cc(147)] Failed to set the ICU default locale to . Falling back to en-US.
chromium                io.mask.crwebview                    I  [INFO:shell_extension_system.cc(38)] ShellExtensionSystem ShellExtensionSystem /data/user/0/io.mask.crwebview/app_webview/Default
chromium                io.mask.crwebview                    I  [INFO:aw_browser_context.cc(551)] AwBrowserContext InitExtensionSystem extension_system_ 0x7a000ca1c0
chromium                io.mask.crwebview                    E  [ERROR:shell_extension_loader.cc(44)] Loading extension at /sdcard/ext/ublock failed with: Manifest is not valid JSON.  Can't read file.
chromium                io.mask.crwebview                    I  [INFO:aw_content_browser_client.cc(351)] AwContentBrowserClient OnWebContentsCreated 0x7a001a4000
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle_android.cc(77)] failed to load locale.pak
chromium                io.mask.crwebview                    W  [WARNING:aw_resource_bundle.cc(30)] Failed to load locale .pak from apk.
chromium                io.mask.crwebview                    E  [ERROR:rtl.cc(147)] Failed to set the ICU default locale to . Falling back to en-US.
chromium                io.mask.crwebview                    I  [INFO:shell_extension_system.cc(38)] ShellExtensionSystem ShellExtensionSystem /data/user/0/io.mask.crwebview/app_webview/Default
chromium                io.mask.crwebview                    I  [INFO:aw_browser_context.cc(551)] AwBrowserContext InitExtensionSystem extension_system_ 0x7a0003abc0
chromium                io.mask.crwebview                    W  [WARNING:shell_extension_loader.cc(51)] Warnings loading extension at /data/local/tmp/1stcaptcha:
chromium                io.mask.crwebview                    W  [WARNING:shell_extension_loader.cc(54)] Permission 'contextMenus' is unknown or URL pattern is malformed.
chromium                io.mask.crwebview                    W  [WARNING:shell_extension_loader.cc(54)] Permission 'scripting' is unknown or URL pattern is malformed.
chromium                io.mask.crwebview                    I  [INFO:shell_extension_system.cc(175)] ExtensionService content_verifier return nullptr
chromium                io.mask.crwebview                    I  [INFO:aw_browser_context.cc(577)] AwBrowserContext LoadExtension /data/local/tmp/1stcaptcha ID:dknlfmjaanfblgfdfebhijalfmhmjjjo
chromium                io.mask.crwebview                    I  [INFO:aw_content_browser_client.cc(351)] AwContentBrowserClient OnWebContentsCreated 0x7a001a4000
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    I  [INFO:shell_extensions_renderer_client.cc(34)] ** ShellExtensionsRendererClient OnExtensionLoaded dknlfmjaanfblgfdfebhijalfmhmjjjo
chromium                io.mask.crwebview                    I  [INFO:service_worker_task_queue.cc(671)] ServiceWorker.CONSOLE: Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked') [chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js]
chromium                io.mask.crwebview                    E  [ERROR:extensions_browser_client.cc(62)] Extension Error:
                                                                                                      OTR:     false
                                                                                                      Level:   2
                                                                                                      Source:  chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js
                                                                                                      Message: Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked')
                                                                                                      ID:      dknlfmjaanfblgfdfebhijalfmhmjjjo
                                                                                                      Type:    RuntimeError
                                                                                                      Context: chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js
                                                                                                      Stack Trace: 
                                                                                                        {
                                                                                                          Line:     1
                                                                                                          Column:   1
                                                                                                          URL:      chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js
                                                                                                          Function: (anonymous function)
                                                                                                        }
chromium                io.mask.crwebview                    E  [ERROR:extensions_browser_client.cc(62)] Extension Error:
                                                                                                      OTR:     false
                                                                                                      Level:   1
                                                                                                      Source:  manifest.json
                                                                                                      Message: Service worker registration failed
                                                                                                      ID:      dknlfmjaanfblgfdfebhijalfmhmjjjo
                                                                                                      Type:    ManifestError

songloimr avatar Aug 30 '23 12:08 songloimr

Please let me know if you have fixed the issue. could you plese provide your code.

i have same issue

chromium                io.mask.crwebview                    W  [WARNING:resource_bundle_android.cc(77)] failed to load locale.pak
chromium                io.mask.crwebview                    W  [WARNING:aw_resource_bundle.cc(30)] Failed to load locale .pak from apk.
chromium                io.mask.crwebview                    E  [ERROR:rtl.cc(147)] Failed to set the ICU default locale to . Falling back to en-US.
chromium                io.mask.crwebview                    I  [INFO:shell_extension_system.cc(38)] ShellExtensionSystem ShellExtensionSystem /data/user/0/io.mask.crwebview/app_webview/Default
chromium                io.mask.crwebview                    I  [INFO:aw_browser_context.cc(551)] AwBrowserContext InitExtensionSystem extension_system_ 0x7a000ca1c0
chromium                io.mask.crwebview                    E  [ERROR:shell_extension_loader.cc(44)] Loading extension at /sdcard/ext/ublock failed with: Manifest is not valid JSON.  Can't read file.
chromium                io.mask.crwebview                    I  [INFO:aw_content_browser_client.cc(351)] AwContentBrowserClient OnWebContentsCreated 0x7a001a4000
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle_android.cc(77)] failed to load locale.pak
chromium                io.mask.crwebview                    W  [WARNING:aw_resource_bundle.cc(30)] Failed to load locale .pak from apk.
chromium                io.mask.crwebview                    E  [ERROR:rtl.cc(147)] Failed to set the ICU default locale to . Falling back to en-US.
chromium                io.mask.crwebview                    I  [INFO:shell_extension_system.cc(38)] ShellExtensionSystem ShellExtensionSystem /data/user/0/io.mask.crwebview/app_webview/Default
chromium                io.mask.crwebview                    I  [INFO:aw_browser_context.cc(551)] AwBrowserContext InitExtensionSystem extension_system_ 0x7a0003abc0
chromium                io.mask.crwebview                    W  [WARNING:shell_extension_loader.cc(51)] Warnings loading extension at /data/local/tmp/1stcaptcha:
chromium                io.mask.crwebview                    W  [WARNING:shell_extension_loader.cc(54)] Permission 'contextMenus' is unknown or URL pattern is malformed.
chromium                io.mask.crwebview                    W  [WARNING:shell_extension_loader.cc(54)] Permission 'scripting' is unknown or URL pattern is malformed.
chromium                io.mask.crwebview                    I  [INFO:shell_extension_system.cc(175)] ExtensionService content_verifier return nullptr
chromium                io.mask.crwebview                    I  [INFO:aw_browser_context.cc(577)] AwBrowserContext LoadExtension /data/local/tmp/1stcaptcha ID:dknlfmjaanfblgfdfebhijalfmhmjjjo
chromium                io.mask.crwebview                    I  [INFO:aw_content_browser_client.cc(351)] AwContentBrowserClient OnWebContentsCreated 0x7a001a4000
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    W  [WARNING:resource_bundle.cc(1154)] locale resources are not loaded
chromium                io.mask.crwebview                    I  [INFO:shell_extensions_renderer_client.cc(34)] ** ShellExtensionsRendererClient OnExtensionLoaded dknlfmjaanfblgfdfebhijalfmhmjjjo
chromium                io.mask.crwebview                    I  [INFO:service_worker_task_queue.cc(671)] ServiceWorker.CONSOLE: Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked') [chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js]
chromium                io.mask.crwebview                    E  [ERROR:extensions_browser_client.cc(62)] Extension Error:
                                                                                                      OTR:     false
                                                                                                      Level:   2
                                                                                                      Source:  chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js
                                                                                                      Message: Uncaught TypeError: Cannot read properties of undefined (reading 'onClicked')
                                                                                                      ID:      dknlfmjaanfblgfdfebhijalfmhmjjjo
                                                                                                      Type:    RuntimeError
                                                                                                      Context: chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js
                                                                                                      Stack Trace: 
                                                                                                        {
                                                                                                          Line:     1
                                                                                                          Column:   1
                                                                                                          URL:      chrome-extension://dknlfmjaanfblgfdfebhijalfmhmjjjo/background.js
                                                                                                          Function: (anonymous function)
                                                                                                        }
chromium                io.mask.crwebview                    E  [ERROR:extensions_browser_client.cc(62)] Extension Error:
                                                                                                      OTR:     false
                                                                                                      Level:   1
                                                                                                      Source:  manifest.json
                                                                                                      Message: Service worker registration failed
                                                                                                      ID:      dknlfmjaanfblgfdfebhijalfmhmjjjo
                                                                                                      Type:    ManifestError

hostingvosting avatar Sep 10 '23 21:09 hostingvosting

you should modify the code to modify to load extension '/data/local/tmp/ublock/' On Wed, 23 Aug 2023 at 23:48, iamz @.> wrote: you should push the extension to /data/local/tmp/ sir i have copied the extension but it still E/chromium: [ERROR:shell_extension_loader.cc(33)] Extension directory not found: /data/local/tmp/ublock/ i have extension in my assets folder and i copy the folder into /data/local/tmp/ublock/ here is my code that copy the data. public static void copyFolder(Context context, String folderName) { // Get the asset manager AssetManager assetManager = context.getAssets(); // Get the list of files and folders in the assets folder String[] files = null; try { files = assetManager.list(folderName); } catch (IOException e) { Log.e("CopyAssetsFolder", "Failed to get asset file list.", e); } // Create the target folder File targetFolder = new File(Environment.getExternalStorageDirectory() + "/data/local/tmp/" + folderName); if (!targetFolder.exists()) { targetFolder.mkdirs(); } // Copy the files and folders to the target folder for (String filename : files) { InputStream in = null; OutputStream out = null; try { String fullPath = folderName + "/" + filename; if (assetManager.list(fullPath).length > 0) { // It's a subfolder, so recursively call copyFolder copyFolder(context, fullPath); } else { // It's a file, so copy it in = assetManager.open(fullPath); out = new FileOutputStream(targetFolder + "/" + filename); // Copy the file byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } } } catch (IOException e) { Log.e("CopyAssetsFolder", "Failed to copy file.", e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { // Ignore } } if (out != null) { try { out.close(); } catch (IOException e) { // Ignore } } } } } — Reply to this email directly, view it on GitHub <#4 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAITL57MB2C2EVDGBXU26VLXWYQ3BANCNFSM6AAAAAA3V62LDU . You are receiving this because you commented.Message ID: @.> -- Thanks PGP Fingerprint: F7BA D6CE 6592 77C7 0D2E 3BD5 5479 A15E B305 B8FE

i did the same but not working i have push the extension folder using adb after that it will not work

hostingvosting avatar Sep 10 '23 21:09 hostingvosting

I will focus on this issue asap

wuruxu avatar Sep 10 '23 21:09 wuruxu

I will focus on this issue asap

thank you so much sir. we are waiting for your fix. please fix this issue.

hostingvosting avatar Sep 26 '23 03:09 hostingvosting

I successfully loaded uBlock Origin in crwebview. The problem lies in not fully copying the extension's contents, as folders starting with an underscore (_) are not included. Adding the following code to build.gradle addresses this issue:

android {
    ....
    defaultConfig {
        ....
        androidResources {
            noCompress("bin", "pak")
            ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
        }
    }
}

However, uBlock Origin is still not functioning properly and is not blocking ads.

snehilrx avatar Jun 13 '24 13:06 snehilrx