title: Ionic 5/Capacitor ERR_CLEARTEXT_NOT_PERMITTED in Android
body: <p>I'm using <strong>Capacitor</strong> for building the Ionic app. These are the following commands run in order to open the android app in Android Studio.</p>
  
  <pre><code>npx cap add android
  ionic build
  npx cap copy
  npx cap open android
  </code></pre>
  
  <p>In Android Studio, I ran the build and click on Run after which I see the error <code>net::ERR_CLEARTEXT_NOT_PERMITTED</code> in my device. I have seen various posts having the same error but those are with <code>Cordova</code> build. In my case, I'm not using Cordova for preparing the android app.</p>
  
  <p><a href="https://i.stack.imgur.com/wPnjXm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wPnjXm.png" alt="error-message"></a></p>
  
  <p>Here are few excerpts from my Ionic App.</p>
  
  <p><code>capacitor.config.json</code>file</p>
  
  <pre><code>{
    "appId": "com.abc",
    "appName": "abc",
    "bundledWebRuntime": false,
    "npmClient": "npm",
    "webDir": "www",
    "cordova": {
      "preferences": {
        "ScrollEnabled": "false",
        "android-minSdkVersion": "19",
        "BackupWebStorage": "none",
        "SplashMaintainAspectRatio": "true",
        "FadeSplashScreenDuration": "0",
        "SplashShowOnlyFirstTime": "false",
        "SplashScreen": "none",
        "SplashScreenDelay": "0"
      }
    },
    "server": {
      "url": "http://192.168.1.208:8100"
    }
  }
  
  </code></pre>
  
  <p>I also see this error in LogCat of Android Studio </p>
  
  <pre><code>W/cr_AwContents: Application attempted to call on a destroyed WebView
      java.lang.Throwable
          at org.chromium.android_webview.AwContents.a(PG:127)
          at org.chromium.android_webview.AwContents.a(PG:209)
          at com.android.webview.chromium.WebViewChromium.evaluateJavaScript(PG:8)
          at android.webkit.WebView.evaluateJavascript(WebView.java:1113)
          at com.getcapacitor.cordova.MockCordovaWebViewImpl$1.run(MockCordovaWebViewImpl.java:203)
          at android.os.Handler.handleCallback(Handler.java:873)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:193)
          at android.app.ActivityThread.main(ActivityThread.java:6923)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
  </code></pre>