Skip to content

Help wanted on getting an angular project to work on mobile webview #18293

Closed Answered by Kvarzsiev
Kvarzsiev asked this question in Q&A
Discussion options

You must be logged in to vote

It was pretty silly actually, I've forgot to change my environments to reflect a valid host for the mobile emulator.

So what I've done is:

  • reconfigured everything to point to 127.0.0.1 (serve options and configs in angular.json, devServer in webpack.config.js)
  • changed my URLs in the project env file to 10.0.2.2 instead of 127.0.0.1 (so android studio emulator tries to connect to the machine host instead of its own)
  • also, changed webpack devserver config for websocket connection url
moduleFederationConfig.devServer = {
 ...
  client: {
    webSocketURL: "ws://10.0.2.2:4202/ws",
  },
};

Because 10.0.2.2 in the Android Studio emulator maps to the machine 127.0.0.1, so the angular server it…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Kvarzsiev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant