Closed kimproductions closed 1 week ago
This issue has been labeled as type: bug
. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.
As workaround you can remove the /
at the end of the url.
As workaround you can remove the
/
at the end of the url.
Thank fixed it thanks! Doesn't work on localhost but that may be because of my wifi. Works fine when i use the computer's ip address http://192.168.1.136:5173 without / at the end
Yeah, you can't use localhost for live reload unless you enable port forwarding. localhost is "this computer", but if you run on an emulator or a real device, localhost is the emulator or the real device themselves, which don't have the live reload server running, the live reload server is in your computer.
You can enable port forwarding from chrome://inspect/#devices
As workaround you can remove the
/
at the end of the url.
I've encountered the same issue. I am using "url": "https://example.com/#/test"
, and it currently runs in the Android Studio emulator virtual device, but it crashes on a physical device.
There was no such problem in previous versions.
Process: cc.bagua, PID: 15550
java.lang.RuntimeException: Unable to start activity ComponentInfo{cc.bagua/cc.bagua.MainActivity}: java.lang.IllegalArgumentException: allowedOriginRules https:example.com is invalid
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3640)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3797)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2215)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:346)
at android.os.Looper.loop(Looper.java:475)
at android.app.ActivityThread.main(ActivityThread.java:7889)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
Caused by: java.lang.IllegalArgumentException: allowedOriginRules https:example.com is invalid
at J.N.MrxnMTWN(Native Method)
at org.chromium.android_webview.AwContents.b(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:36)
at WV.sS.addDocumentStartJavaScript(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:39)
at java.lang.reflect.Method.invoke(Native Method)
at WV.ya.invoke(chromium-TrichromeWebViewGoogle6432.aab-stable-626111933:36)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy3.addDocumentStartJavaScript(Unknown Source)
at androidx.webkit.internal.WebViewProviderAdapter.addDocumentStartJavaScript(WebViewProviderAdapter.java:110)
at androidx.webkit.WebViewCompat.addDocumentStartJavaScript(WebViewCompat.java:823)
at com.getcapacitor.Bridge.loadWebView(Bridge.java:262)
at com.getcapacitor.Bridge.<init>(Bridge.java:223)
at com.getcapacitor.Bridge.<init>(Unknown Source:0)
at com.getcapacitor.Bridge$Builder.create(Bridge.java:1555)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:48)
at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:42)
at android.app.Activity.performCreate(Activity.java:8050)
at android.app.Activity.performCreate(Activity.java:8030)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1330)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3613)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3797)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2215)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:346)
at android.os.Looper.loop(Looper.java:475)
at android.app.ActivityThread.main(ActivityThread.java:7889)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
@jcesarmobile Fantastic, removing the trailing slash from server.url
solved it for me as well!
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0
Installed Dependencies:
@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0
[success] iOS looking great! 👌 [success] Android looking great! 👌
Other API Details
Platforms Affected
Current Behavior
On Android, I'm getting an error when trying to use a development server for live reloading. Not using a dev server (removing the server url options from capacitor config) works completely fine. IOS both dev server and no dev server works fine.
When running a simple react vite project, I have the vite server open in one terminal window and setup the capacitor config as so:
After running npm run build, npx cap sync, npx cap open android and then pressing play on the emulator, I get this error:
My suspicion is that the URL format seems a bit strange without the dashes, or it could be some cors issue. The production build works fine just not dev server and both are working on ios for some reason.
Heres the full log:
Expected Behavior
Expected behavior is for the dev server to work and whenever I save files to be able to hotreload changes.
Project Reproduction
https://github.com/kimproductions/capacitor-devserver-not-working
Additional Information
No response