"FileOpener" plugin is not implemented on android

I am trying to develop a pdf viewing ability for android, but I keep running into this error:
"FileOpener" plugin is not implemented on android

I have tried both capawesome and capacitor-community fileopener, but keep running into the same issue. I have searched through web, I have ensured it is not one of the common causes:

  1. Only have only one of the plugins installed to avoid issues like this:
(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/tlbot_website/frontend$ npm list| grep file
β”œβ”€β”€ @capacitor-community/file-opener@7.0.1
β”œβ”€β”€ @capacitor/filesystem@7.0.0
(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/tlbot_website/frontend$ 
  1. For viewing on the mobile, ensure you are downloading the file first.
    In my case, I am able to see the file downloaded inside files folder. I can open it and see the file, but my app crashes and I cannot see the file inside my app. Console logs.
[info][console] Opening PDF with FileOpener
[verbose][capacitor] callbackId: 24677522, pluginId: Filesystem, methodName: requestPermissions
[verbose][capacitor] callback: 24677522, pluginId: Filesystem, methodName: requestPermissions, methodData: {}
[verbose][capacitor] callbackId: 24677523, pluginId: Filesystem, methodName: writeFile
[verbose][capacitor] callback: 24677523, pluginId: Filesystem, methodName: writeFile, methodData: {"path":"MyPDFs\/my-pdf.pdf","data":"JVBERi0xLjQKJfbk\/N8KMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovVmVyc2lvbiAvMS40Ci9QYWdlcyAyIDAgUgovU3RydWN0VHJlZVJvb3QgMyAwIFIKL01hcmtJbmZvIDQgMCBSCi9MYW5nIChlbikKL1ZpZXdlclByZWZlcmVuY2VzIDUgMCBSCj4+CmVuZG9iago2IDAgb2JqCjw8Ci9UaXRsZSAoQ29weSBvZiBGb29kIFFSIENvZGUgVmVydGljYWwgQnVzaW5lc3MgQ2FyZCBCbGFjayBXaGl0ZSBNb2Rlcm4gTWluaW1hbGlzdCkKL0NyZWF0b3IgKENhbnZhKQovUHJvZHVjZXIgKENhbnZhKQovQ3JlYXRpb25EYXRlIChEOjIwMjQwOTIwMjI1ODU0KzAwJzAwJykKL01vZERhdGUgKEQ6Mj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AwMDAgbg0KMDAwMDAxMzYxOSAwMDAwMCBuDQowMDAwMDEzODIxIDAwMDAwIG4NCjAwMDAwMTM4OTYgMDAwMDAgbg0KMDAwMDAxNDA5OCAwMDAwMCBuDQowMDAwMDE0MTczIDAwMDAwIG4NCjAwMDAwMTQzNzggMDAwMDAgbg0KMDAwMDAxNDQ1MyAwMDAwMCBuDQowMDAwMDE2NDUxIDAwMDAwIG4NCjAwMDAwMTc5NzIgMDAwMDAgbg0KMDAwMDAxOTE3NyAwMDAwMCBuDQowMDAwMDIxNDYzIDAwMDAwIG4NCnRyYWlsZXIKPDwKL1Jvb3QgMSAwIFIKL0luZm8gNiAwIFIKL0lEIFs8RDQyNTNBNDBFOTIzMzdDMzAxRjJEQUE1MDU2QTE1NUI+IDxENDI1M0E0MEU5MjMzN0MzMDFGMkRBQTUwNTZBMTU1Qj5dCi9TaXplIDcwCj4+CnN0YXJ0eHJlZgoyNDYxMwolJUVPRgo=","directory":"DOCUMENTS","recursive":true}
[info][console] PDF saved to: file:///storage/emulated/0/Documents/MyPDFs/my-pdf.pdf
[error][console] FileOpener error: Error: "FileOpener" plugin is not implemented on android
[info][console] An error occurred while opening the PDF

I am not sure what I am doing wrong. This is my entire component. I would appreciate any insights on something I might have missed:

<!-- filepath: /home/arpit/Desktop/AI_Experiments/tlbot_website/frontend/src/components/PDFViewerModal.vue -->
<template>
    <ion-modal :is-open="isOpen" swipeToClose="true" @ionModalDidDismiss="closeModal">
        <ion-content>
            <ion-button fill="clear" color="medium" @click="closeModal"
                style="position:absolute; top:10px; right:10px; z-index:1000;">
                Close
            </ion-button>

            <div v-if="embedForWeb" class="pdf-container">
                <!-- Simple iframe embed for web browsers -->
                <iframe v-if="pdfUrl" :src="pdfUrl" width="100%" height="100%"></iframe>
                <div v-else class="no-pdf">No PDF URL provided</div>
            </div>
        </ion-content>
    </ion-modal>
</template>

<script lang="ts" setup>
import { ref, onMounted, watch } from 'vue';
import { defineProps, defineEmits } from 'vue';
import { IonModal, IonContent, IonButton } from '@ionic/vue';
import { Capacitor } from '@capacitor/core';
import { FileOpener, FileOpenerOptions } from '@capacitor-community/file-opener';
// import { FileOpener } from '@capawesome-team/capacitor-file-opener';
import { Filesystem, Directory } from '@capacitor/filesystem';
import api from '@/services/api';
import { Toast } from '@capacitor/toast'; // Import Capacitor Toast

const props = defineProps({
    isOpen: { type: Boolean, required: true },
    pdfUrl: { type: String, default: '' }
});
const emit = defineEmits(['update:isOpen']);

function closeModal() {
    emit('update:isOpen', false);
}

const embedForWeb = ref(true);

async function requestFSAccess() {
    // Explicitly request storage permission if needed on Android
    try {
        await Filesystem.requestPermissions();
    } catch (err) {
        console.error('Could not request FS permission:', err);
    }
}

async function openPDFWithFileOpener() {
    if (!props.pdfUrl) return;

    if (Capacitor.isNativePlatform()) {
        // Request permission to store the file in Documents
        await requestFSAccess();

        try {
            // 1. Fetch the PDF as a Blob
            const response = await api.get(props.pdfUrl, {
                responseType: 'blob',
            });
            const blob = response.data;

            // 2. Convert Blob to Base64
            const reader = new FileReader();
            reader.onloadend = async () => {
                const base64String = reader.result as string;
                const base64Data = base64String.replace(/^data:application\/pdf;base64,/, '');

                // 3. Write to Documents folder rather than Cache
                // so you can see it in a file manager
                const { uri } = await Filesystem.writeFile({
                    path: 'MyPDFs/my-pdf.pdf',
                    data: base64Data,
                    directory: Directory.Documents,
                    recursive: true,
                });
                console.log('PDF saved to:', uri);

                // 4. Open the File: Native method using FileOpener
                try {
                    const fileOpenerOptions: FileOpenerOptions = {
                        filePath: props.pdfUrl,
                        contentType: 'application/pdf',
                        openWithDefault: true
                    };
                    await FileOpener.open(fileOpenerOptions);
                } catch (err: any) {
                    console.error('FileOpener error:', err);
                    // Handle the error gracefully
                    if (err.message === 'No Activity Found') {
                        // Display a message to the user that no app is available to open the PDF
                        console.log('No app found to open PDF');
                    } else {
                        // Handle other errors
                        console.log('An error occurred while opening the PDF');
                    }
                }
                // 5. Alternative method to open the file using capawesome
                // try {
                //     await FileOpener.openFile({
                //         path: uri,
                //         contentType: 'application/pdf',
                //     });
                //     console.log('File opened');
                // } catch (fileOpenerError: any) {
                //     console.error('FileOpener error:', fileOpenerError);
                //     // Catch and ignore "not implemented" error
                //     if (fileOpenerError.message.includes('not implemented on android')) {
                //         console.warn('FileOpener not implemented on Android, but PDF saved.');
                //         // Show notification to user
                //         await Toast.show({
                //             text: 'PDF saved to Files folder. Please check your device file manager.',
                //             duration: 'long',
                //         });
                //     } else {
                //         // Handle other FileOpener errors
                //         console.error('Error opening PDF:', fileOpenerError);
                //     }
                // }
            };
            reader.onerror = (error) => {
                console.error('Error reading blob:', error);
            };
            reader.readAsDataURL(blob);
        } catch (err: any) {
            console.error('FileOpener error:', err);
        }
    } else {
        // Handle web-based PDF viewing
        window.open(props.pdfUrl, '_blank');
    }
}

function openPDFWeb() {
    // This allows the browser to open the PDF in a new tab
    window.open(props.pdfUrl, '_blank');
}

watch(
    () => props.isOpen,
    async (newVal) => {
        if (newVal) {
            if (Capacitor.isNativePlatform()) {
                console.log('Opening PDF with FileOpener');
                // For Android/iOS, open the file externally
                embedForWeb.value = false;
                await openPDFWithFileOpener();
                // Immediately close the modal after launching the external viewer, 
                // or remove this line if you want the modal to remain visible.
                closeModal();
            } else {
                // For web, just show the iframe
                // embedForWeb.value = true;
                // web
                console.log('Opening PDF for web');
                embedForWeb.value = false;  // Not showing the iframe anymore
                openPDFWeb();
                closeModal();
            }
        }
    }
);

onMounted(() => {
    // Decide whether to embed or use FileOpener on mount
    if (Capacitor.isNativePlatform()) {
        embedForWeb.value = false;
    }
});
</script>

<style scoped>
.pdf-container {
    position: relative;
    width: 100%;
    height: 100vh;
    /* Adjust as needed */
    overflow: hidden;
}

.pdf-container iframe {
    border: none;
}

.no-pdf {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-weight: 500;
    color: #666;
}
</style>
1 Like

Please check out this troubleshooting guide.

Hi @robingenz
I checked out the troubleshooting guide. It does not seem to be one of those issue. I can see the plugin for android:

(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/tlbot_website/frontend$ npx cap sync android
βœ” Copying web assets from dist to android/app/src/main/assets/public in 39.68ms
βœ” Creating capacitor.config.json in android/app/src/main/assets in 1.61ms
βœ” copy android in 79.44ms
βœ” Updating Android plugins in 17.42ms
[info] Found 5 Capacitor plugins for android:
       @capacitor-community/file-opener@7.0.1
       @capacitor/browser@7.0.0
       @capacitor/camera@7.0.0
       @capacitor/filesystem@7.0.0
       @capacitor/toast@7.0.0
βœ” update android in 124.14ms
[info] Sync finished in 0.283s
(reverse-i-search)`open': npm install @capacitor-community/file-^Cener
(base) arpit@arpit-Precision-5540

I am running directly on my android phone using the nexus. However, I did sync the project inside android studio, and upgraded my gradle version to 8.7.3. frontend/android/build.gradle and frontend/android/gradle/wrapper/gradle-wrapper.properties were updated after that.

I also upgraded my node version from v20.18 to v22.14.0 and did a clean rebuild,

(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/tlbot_website/frontend$ node -v
v22.14.0

I ran a npm run build after that, restested using nexus. Still seeing the same error "FileOpener" plugin is not implemented on android

PS: Sorry about the deleted post, I noticed my node version was originally v20 and thus wanted to upgrade and retest it before posting.

After upgrading my gradle version, and doing a full clean install of the project I noticed, that my build is failing, will figure out this issue first and then post back if I am still seeing the pdf viewing issue.

(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/tlbot_website/frontend$ npm run capacitor:run:android --info --scan
βœ” Copying web assets from dist to android/app/src/main/assets/public in 27.76ms
βœ” Creating capacitor.config.json in android/app/src/main/assets in 674.12ΞΌs
β ™ copy android [info] Inlining sourcemaps
βœ” copy android in 99.87ms
βœ” Updating Android plugins in 10.96ms
[info] Found 5 Capacitor plugins for android:
       @capacitor-community/file-opener@7.0.1
       @capacitor/browser@7.0.0
       @capacitor/camera@7.0.0
       @capacitor/filesystem@7.0.0
       @capacitor/toast@7.0.0
βœ” update android in 82.61ms
βœ– Running Gradle build - failed!
[error] 
        > Configure project :app
        WARNING: Using flatDir should be avoided because it doesn't support any meta-data formats.
        
        > Configure project :capacitor-cordova-android-plugins
        WARNING: Using flatDir should be avoided because it doesn't support any meta-data formats.
        
        > Task :app:preBuild UP-TO-DATE
        > Task :app:preDebugBuild UP-TO-DATE
        > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
        > Task :app:javaPreCompileDebug UP-TO-DATE
        > Task :capacitor-android:preBuild UP-TO-DATE
        > Task :capacitor-android:preDebugBuild UP-TO-DATE
        > Task :capacitor-android:writeDebugAarMetadata UP-TO-DATE
        > Task :capacitor-browser:preBuild UP-TO-DATE
        > Task :capacitor-browser:preDebugBuild UP-TO-DATE
        > Task :capacitor-browser:writeDebugAarMetadata UP-TO-DATE
        > Task :capacitor-camera:preBuild UP-TO-DATE
        > Task :capacitor-camera:preDebugBuild UP-TO-DATE
        > Task :capacitor-camera:writeDebugAarMetadata UP-TO-DATE
        > Task :capacitor-community-file-opener:preBuild UP-TO-DATE
        > Task :capacitor-community-file-opener:preDebugBuild UP-TO-DATE
        > Task :capacitor-community-file-opener:writeDebugAarMetadata UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
        > Task :capacitor-filesystem:preBuild UP-TO-DATE
        > Task :capacitor-filesystem:preDebugBuild UP-TO-DATE
        > Task :capacitor-filesystem:writeDebugAarMetadata UP-TO-DATE
        > Task :capacitor-toast:preBuild UP-TO-DATE
        > Task :capacitor-toast:preDebugBuild UP-TO-DATE
        > Task :capacitor-toast:writeDebugAarMetadata UP-TO-DATE
        > Task :app:checkDebugAarMetadata UP-TO-DATE
        > Task :app:generateDebugResValues UP-TO-DATE
        > Task :capacitor-android:generateDebugResValues UP-TO-DATE
        > Task :capacitor-android:generateDebugResources UP-TO-DATE
        > Task :capacitor-android:packageDebugResources UP-TO-DATE
        > Task :capacitor-browser:generateDebugResValues UP-TO-DATE
        > Task :capacitor-browser:generateDebugResources UP-TO-DATE
        > Task :capacitor-browser:packageDebugResources UP-TO-DATE
        > Task :capacitor-camera:generateDebugResValues UP-TO-DATE
        > Task :capacitor-camera:generateDebugResources UP-TO-DATE
        > Task :capacitor-camera:packageDebugResources UP-TO-DATE
        > Task :capacitor-community-file-opener:generateDebugResValues UP-TO-DATE
        > Task :capacitor-community-file-opener:generateDebugResources UP-TO-DATE
        > Task :capacitor-community-file-opener:packageDebugResources UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:generateDebugResValues
        > Task :capacitor-cordova-android-plugins:generateDebugResources
        > Task :capacitor-cordova-android-plugins:packageDebugResources
        > Task :capacitor-filesystem:generateDebugResValues UP-TO-DATE
        > Task :capacitor-filesystem:generateDebugResources UP-TO-DATE
        > Task :capacitor-filesystem:packageDebugResources UP-TO-DATE
        > Task :capacitor-toast:generateDebugResValues UP-TO-DATE
        > Task :capacitor-toast:generateDebugResources UP-TO-DATE
        > Task :capacitor-toast:packageDebugResources UP-TO-DATE
        > Task :app:mapDebugSourceSetPaths UP-TO-DATE
        > Task :app:generateDebugResources UP-TO-DATE
        > Task :app:mergeDebugResources UP-TO-DATE
        > Task :app:packageDebugResources UP-TO-DATE
        > Task :app:parseDebugLocalResources UP-TO-DATE
        > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
        > Task :app:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-android:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-android:processDebugManifest UP-TO-DATE
        > Task :capacitor-browser:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-browser:processDebugManifest UP-TO-DATE
        > Task :capacitor-camera:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-camera:processDebugManifest UP-TO-DATE
        > Task :capacitor-community-file-opener:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-community-file-opener:processDebugManifest UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:extractDeepLinksDebug
        > Task :capacitor-filesystem:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-filesystem:processDebugManifest UP-TO-DATE
        > Task :capacitor-toast:extractDeepLinksDebug UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:processDebugManifest
        > Task :capacitor-toast:processDebugManifest UP-TO-DATE
        > Task :app:processDebugMainManifest UP-TO-DATE
        > Task :app:processDebugManifest UP-TO-DATE
        > Task :app:processDebugManifestForPackage UP-TO-DATE
        > Task :capacitor-android:compileDebugLibraryResources UP-TO-DATE
        > Task :capacitor-android:parseDebugLocalResources UP-TO-DATE
        > Task :capacitor-android:generateDebugRFile UP-TO-DATE
        > Task :capacitor-browser:compileDebugLibraryResources UP-TO-DATE
        > Task :capacitor-browser:parseDebugLocalResources UP-TO-DATE
        > Task :capacitor-browser:generateDebugRFile UP-TO-DATE
        > Task :capacitor-camera:compileDebugLibraryResources UP-TO-DATE
        > Task :capacitor-camera:parseDebugLocalResources UP-TO-DATE
        > Task :capacitor-camera:generateDebugRFile UP-TO-DATE
        > Task :capacitor-community-file-opener:compileDebugLibraryResources UP-TO-DATE
        > Task :capacitor-community-file-opener:parseDebugLocalResources UP-TO-DATE
        > Task :capacitor-community-file-opener:generateDebugRFile UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:compileDebugLibraryResources
        > Task :capacitor-filesystem:compileDebugLibraryResources UP-TO-DATE
        > Task :capacitor-filesystem:parseDebugLocalResources UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:parseDebugLocalResources
        > Task :capacitor-filesystem:generateDebugRFile UP-TO-DATE
        > Task :capacitor-toast:compileDebugLibraryResources UP-TO-DATE
        > Task :capacitor-toast:parseDebugLocalResources UP-TO-DATE
        > Task :capacitor-cordova-android-plugins:generateDebugRFile
        > Task :capacitor-toast:generateDebugRFile UP-TO-DATE
        > Task :app:processDebugResources UP-TO-DATE
        > Task :capacitor-android:javaPreCompileDebug UP-TO-DATE
        
        > Task :capacitor-android:compileDebugJavaWithJavac FAILED
        /home/arpit/Desktop/AI_Experiments/tlbot_website/frontend/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java:66:
        error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM &&
        configEdgeToEdge.equals("auto")) {
        ^
        symbol:   variable VANILLA_ICE_CREAM
        location: class VERSION_CODES
        /home/arpit/Desktop/AI_Experiments/tlbot_website/frontend/node_modules/@capacitor/android/capacitor/src/main/java/com/getcapacitor/CapacitorWebView.java:68:
        error: cannot find symbol
        boolean foundOptOut =
        getContext().getTheme().resolveAttribute(android.R.attr.windowOptOutEdgeToEdgeEnforcement,
        value, true);
        ^
        symbol:   variable windowOptOutEdgeToEdgeEnforcement
        location: class attr
        Note: Some input files use unchecked or unsafe operations.
        Note: Recompile with -Xlint:unchecked for details.
        2 errors
        
        FAILURE: Build failed with an exception.
        
        * What went wrong:
        Execution failed for task ':capacitor-android:compileDebugJavaWithJavac'.
        > Compilation failed; see the compiler error output for details.
        
        * Try:
        > Run with --info option to get more log output.
        > Run with --scan to get full insights.
        
        BUILD FAILED in 4s
        79 actionable tasks: 10 executed, 69 up-to-date
        

Update:
After following this comment and upgrading the compile and targetSdK version to 35, I was able to solve the VANILLA variable issue. Now build completes fine, and did fresh sync+builds. But still running into the same issue.

Nexus browser is a prebuilt Capacitor app that have a set of installed plugins, so not every Capacitor plugin will be available to use.

File Opener doesn’t seem to be installed

There is an example application in the file opener repo - see file-opener/example-app at master Β· capacitor-community/file-opener Β· GitHub. Can you please try to build and run it and see if it works for you?

Please also see this GitHub - capacitor-community/file-opener: Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri. This plugin is similar to cordova-plugin-file-opener2 without installation support.

I have run into the same issue after migrating from capacitor 6 to 7. @arpitpatel901 did you manage to
fix it?

@ryaa I did look at the example app before, but unfortunately the example app is built in angular, while my project stack is built on Vue3, so I couldnt use the code directly. But I was able to clone the repo, do npm install,npm run build but when I run

(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/file-opener/example-app$ npx cap run android --live-reload
βœ” Copying web assets from browser to android/app/src/main/assets/public in 18.70ms
βœ” Creating capacitor.config.json in android/app/src/main/assets in 682.65ΞΌs
[info] Inlining sourcemaps
βœ” copy android in 50.58ms
βœ” Updating Android plugins in 4.63ms
[info] Found 6 Capacitor plugins for android:
       @capacitor-community/file-opener@7.0.1
       @capacitor/app@7.0.0
       @capacitor/camera@7.0.0
       @capacitor/haptics@7.0.0
       @capacitor/keyboard@7.0.0
       @capacitor/status-bar@7.0.0
βœ” update android in 43.11ms
βœ” Running Gradle build in 1.38s
β Έ Deploying app-debug.apk to Medium_Phone_API_35 ^C
(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/file-opener/example-app$ 

I get the following error.

Webpage not available: The webpage at http://192.168.1.177:3000/ could not be loaded because:
net::ERR_CONNECTION_REFUSED

I am not sure if I need to run the backend and expose the port. I ran npm run test, but that only opens up an automated browser.

@Peedvar I havent yet been able to fix the issue yet, but until now I have been testing with nexus[which does not have that library installed]. I need to learn and get familiar with android studio, and testing with a physical device connected. I’ll update if I make any progress.

Update:

I did run the below command, while running the above android command to test in emulator. But got the same result. I think I need to expose port to android studio somewhere. Maybe we need to update capactor.config in the example-app.

(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/file-opener/example-app$ npm install -g @ionic/cli
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 209 packages in 5s

34 packages are looking for funding
  run `npm fund` for details
(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/file-opener/example-app$ 
(base) arpit@arpit-Precision-5540:~/Desktop/AI_Experiments/file-opener/example-app$ npm run serve:dev

> example-app@7.0.1 serve:dev
> npm run clear:cache && ionic serve --configuration development


> example-app@7.0.1 clear:cache
> rm -rf .angular/cache

> ng run app:serve:development --host=localhost --port=8100
[ng] Component HMR has been enabled.
[ng] If you encounter application reload issues, you can manually reload the page to bypass HMR and/or disable this feature with the `--no-hmr` command line option.
[ng] Please consider reporting any issues you encounter here: https://github.com/angular/angular-cli/issues
[ng] 
[ng] ❯ Building...
[ng] βœ” Building...
[ng] Initial chunk files   | Names         |  Raw size
[ng] polyfills.js          | polyfills     |  90.97 kB | 
[ng] styles.css            | styles        |  35.65 kB | 
[ng] main.js               | main          |   2.46 kB | 
[ng] chunk-C4KO2HLL.js     | -             | 614 bytes | 
[ng]                       | Initial total | 129.69 kB
[ng] Lazy chunk files      | Names         |  Raw size
[ng] home.page-AXHS4OS2.js | home-page     |   5.55 kB | 
[ng] Application bundle generation complete. [2.949 seconds]
[ng] NOTE: Raw file sizes do not reflect development server per-request transformations.

[INFO] Development server running!
       
       Local: http://localhost:8100
       
       Use Ctrl+C to quit this process

[ng]   ➜  Local:   http://localhost:8100/
[ng]   ➜  press h + enter to show help
[INFO] Browser window opened to http://localhost:8100!