vue-cli-plugin-capacitor
vue-cli-plugin-capacitor copied to clipboard
Unable to app load , are you sure your server running at ipaddress:port?
Describe the bug
This error i am getting in debug apk , i am using npm run capacitor:serve to run debug mode while app running appear "unable to app load, are you sure server running at ipaddress:port?" then i tested same url in my computer browser worked well but not worked in my mobile and i also tried turn off my firewall and allowed inbound rule 8080 this case also not worked for me.
then i run ipconfig command in shell it list out some ip address one of them worked in my mobile but i don't how to use that ipaddress in capacitor ?.
what is the solution for this?
capacitorConfig.server.url = serverUrl
async function setCapacitorConfig (platform, serverUrl, webDir) {
let configPath
// Read existing config
if (platform === 'android') {
configPath = './android/app/src/main/assets/capacitor.config.json'
} else if (platform === 'ios') {
configPath = './ios/App/App/capacitor.config.json'
} else {
configPath = './capacitor.config.json'
}
const capacitorConfig = JSON.parse(
await fs.readFile(api.resolve(configPath), 'utf8')
)
if (serverUrl) {
capacitorConfig.server = capacitorConfig.server || {}
capacitorConfig.server.url = serverUrl
}
if (webDir) {
capacitorConfig.webDir = webDir
}
// Write updated config
await fs.writeFile(api.resolve(configPath), JSON.stringify(capacitorConfig))
}
}
please fix this
please apply same url if server.url in capacitor.config.json instead below one
if (serverUrl) {
capacitorConfig.server = capacitorConfig.server || {}
capacitorConfig.server.url = serverUrl
}
i think this is fix above problem
if (serverUrl&&!capacitorConfig.hasOwnProperty('server')) {
capacitorConfig.server = capacitorConfig.server || {}
capacitorConfig.server.url = serverUrl
}