- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hello Everyone,
I'm trying to use weinre to debug my third party plugins. I had it successfully working previously but now it seems that every build I do crashes if I add the ip address target script. The app will start on splash screen, turn white, and wait for several seconds then give me the alert "Application Error. The connection to the server was unsuccessful. (file:///android_asset/www/index.html)"
I built a blank app with html5 + cordova then added my ipaddress script to that app and built the apk. I still get the same result.
The weird thing is if I leave the IP address script in the header and I run the 'simulate' tab. Weinre can see it perfectly and shows up in the target section in the console. It only disapproves when its the apk trying to call it.
Everyone of my apps that I have applied the script tag will crash now when I try to open the apk in my phone. I don't know what I'm doing wrong and I've tried for a day or so to fix this issue. Can anyone give me any tips as to why this is happening?
Thanks,
Ramon Escamilla
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Ramon -- I'm assuming you are trying to talk to a local weinre server that is running on your dev machine, because the XDK cloud-based weinre server has been retired.
When I've had troubles with weinre it is caused by where I place the weinre script tag within the app. Sometimes it works best if it is the very first script tag, and sometimes the very last. Have you tried relocating the script tag within the app?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Another thing to check are your whitelist rules and CSP rules. The IP address of the machine that is hosting the weinre server needs to be part of the whitelist and/or CSP rule. Those rules are not relevant in the Simulate tab, only in a built app.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Paul, I added a line to the header <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> all it did was skip over the weinre code. Weinre still couldn't see my built apk. I moved around the script tag but it didnt do anything. I also added my ip address to the whitelist section and still nothing. I have a feeling it has something to do with my build settings or my weinre.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Try leaving the CSP rule out and just use the whitelist rules. When you fill in your IP address in the whitelist rules, put it in both the <access> and <allow-navigation> fields, for example:
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Paul,
Still doesn't seem to work. Do you think I should try to uninstall and reinstall intel xdk?
Thanks,
Ramon
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
XDK doesn't have anything to do with access to your local weinre server (other than things like whitelist settings for a build). Are you able to connect to your local weinre server when your app is running inside of App Preview?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Paul,
When I click the simulate tab and I try run the app. It gets seen by weinre and I can perform console.logs and see the elements. However when I build the app and I install it onto my phone (samsung s5) it gives me the Application Error. I don't know why weinre would be different. I was reading through the weinre documentation and I saw this
VERY IMPORTANT! You should never leave a weinre script tag enabled in the index.html file of a published app. Doing so means that every instance of your app will attempt to contact your weinre server when it starts, resulting in a delayed or hung startup of your app (due to having to use the network to contact the weinre server), excessive use of your customer's mobile data and confusion.
I feel like this is probably whats happening to me, however Ive added the ip address so I don't know why its not connecting. I'm currently at work but when I get home I'll trouble shoot some more.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi Ramon,
Is your phone connected to the same local wifi network as the weinre server is running on?
It might seem obvious, but I've wasted lots of time troubleshooting where the problem was that I forgot to switch my phone to wifi!
Tony
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Tony,
Thanks for the suggestion. After your reply I noticed my phone for some reason was joining my neighbors wifi rather than mine... ugh.. lol. I just saw that it was connected never went in and checked whos network it was connecting too.
Thanks,
Ramon Escamilla
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Ramon,
Yep, I've had that happen to me as well, very annoying! In my case it was an open wifi from a restaurant near my office.
Thanks for sharing your next steps!
So for anyone reading this in future, the correct troubleshooting steps for WEINRE connectivity are:
- Are you on wifi?
- Are you on the CORRECT wifi?
Tony
