Giter Site home page Giter Site logo

capacitor-live-reload-bug's Introduction

Created with Capacitor Create App

A minimal reproduction for Android live reload config issues in Capacitor 5.7.2. See ionic-team/capacitor#7323 for the bug details.

This app was created using @capacitor/create-app.

Installing

  • You will need Node.JS
  • Ensure Android Studio is installed, and that ANDROID_HOME is set (e.g. export ANDROID_HOME=$ANDROID_SDK_ROOT)
  • npm install in the root dir

Running this example

  1. Start the live reload server, which will run on host machine port 3000
npm run start:server
  1. In a new terminal, run the Android capacitor app, which is set up for live reload pointing to that server:
npm run start:android

If you want to see what these commands do, peek at package.json

Issues

You will see an ERR_CLEARTEXT_NOT_PERMITTED error:

error image

  • Observe that the generated android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml's <application> tag is not patched to contain android:usesCleartextTraffic="true"

  • Capacitor's cordova.ts should be adding this when run in live reload mode. It does not seem to be doing so in v5.7.2

Workaround

If we manually add the clear text attribute back in, it will work:

  1. Add android:usesCleartextTraffic="true" to the <application> tag in the main AndroidManifest.xml (not the generated one)
  2. Run the android simulator, and observe you now see the contents of src/index.html
  3. Edit src/index.html and see the app live reloading successfully

This is not a good workaround, however, as it is insecure.

We also cannot reliably time + manually patch the cordova android plugin AndroidManifest.xml as we do not control when that's generated.

capacitor-live-reload-bug's People

Contributors

alextreppass avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.