gpt4 book ai didi

android - Android 中的 ionic 5/电容器 ERR_CLEARTEXT_NOT_PERMITTED

转载 作者:行者123 更新时间:2023-12-03 18:17:14 24 4
gpt4 key购买 nike

我正在使用 电容用于构建 Ionic 应用程序。这些是为了在 Android Studio 中打开 android 应用程序而运行的以下命令。

npx cap add android
ionic build
npx cap copy
npx cap open android

在 Android Studio 中,我运行构建并单击运行,之后我看到错误 net::ERR_CLEARTEXT_NOT_PERMITTED在我的设备中。我见过各种帖子都有相同的错误,但那些是 Cordova build 。就我而言,我没有使用 Cordova 来准备 android 应用程序。

error-message

以下是我的 Ionic App 的一些摘录。
capacitor.config.json文件
{
"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"
}
}


我也在 Android Studio 的 LogCat 中看到了这个错误
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)

最佳答案

将此添加给您AndroidManifest.xmlapplication元素

<application
android:usesCleartextTraffic="true"

关于android - Android 中的 ionic 5/电容器 ERR_CLEARTEXT_NOT_PERMITTED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60906953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com