gapdebug problem loading url

来源:互联网 发布:知乎 陈廖宇 编辑:程序博客网 时间:2024/06/08 05:04

使用app调试工具Gapdebug时,一般第一次连接手机可能会出现连接不上的情况,需要翻墙联网,Psiphon3是一个免费的翻墙工具。下载链接:https://pan.baidu.com/s/1qYPx4LY

之后仍可能会出现如下错误:

Problemloadingurl:http://chrome-devtools-frontend.appspot.com/serve_rev/xxxx/emulated_devices/emulated_devices_module.jsStatuscode:0

有效的解决办法,把gapdebug安装目录下的\AppData\Local\GapDebug\plugins\com.genuitec.powderhorn.deviceconnector_16.x.x.xxxxx\res\gapdebug\loadcdt.html中的内容替换成下面的代码

<html><head><script type="text/javascript">window.onload = function() {var params = {};location.search.substr(1).split("&").forEach(function(item) {var sp = item.split("=");params[sp[0]] = decodeURIComponent(sp[1]); });var baseUrl = params["base"];var manifestUrl = params["toload"];var uploadUrl = params["toupload"];var md5Url = params["md5"];var redirectThen = params["redirect"];var rev = params["rev"];var eq = function(str) {return function(v) {return v === str;};}var cached = false;var lineType = [{ sel : eq("CACHE MANIFEST"), process: function(l) { cached = true; } },{ sel : eq("FALLBACK:"), process: function(l) { cached = false; } },{ sel : eq("NETWORK:"), process: function(l) { cached = false; } },{ sel : eq("CACHE:"), process: function(l) { cached = true; } }];var reportError = function(url, status) {document.body.setAttribute("error", "true");document.getElementById('errUrl').innerText = url;document.getElementById('statusCode').innerText = status;}var filestotal = 0;var toLoad = [];var xhr = new XMLHttpRequest();xhr.open("GET", baseUrl + manifestUrl, true);xhr.onerror = function () {reportError(baseUrl + manifestUrl, xhr.status);}xhr.onload = function(e) {var lines = xhr.responseText.split(/\r\n|\r|\n/);for (var ln in lines) {var l = lines[ln];l = (l.split("#") || [ l ])[0].trim();var lti = 0;for (; lti < lineType.length; ++lti) {if (lineType[lti].sel(l)) {lineType[lti].process(l);break;}}if (lti == lineType.length && cached && l.length > 0) {var shortUrl = l;toLoad.push(shortUrl);}}filestotal = toLoad.length;document.getElementById('filestotal').innerHTML = filestotal; // save manifestvar xhr2 = new XMLHttpRequest();xhr2.open("POST", uploadUrl + manifestUrl, true);xhr2.onload = function (oEvent) {//build md5 & save to aid in future cache coherency checking (i.e., is there a new ver of cdt)// compute md5var xhr3 = new XMLHttpRequest();xhr3.open("POST", md5Url, true);xhr3.onload = function (oEvent) {var md5 = xhr3.responseText;// save md5var xhr4 = new XMLHttpRequest();xhr4.open("POST", uploadUrl + '_md5_', true);xhr4.send(md5);}xhr3.send(xhr.responseText);// Uploaded.// Load filegoLoading();};xhr2.send(xhr.responseText);};xhr.send();var goLoading = function() {if (toLoad.length == 0) {// Let's say we finished loading.var xhr2 = new XMLHttpRequest();xhr2.open("GET", uploadUrl, true);xhr2.onload = function (oEvent) {if (!!redirectThen) {// location.href = redirectThen;}};xhr2.send();return;}document.getElementById('fileno').innerHTML = filestotal - toLoad.length;document.getElementById('rev').innerHTML = rev;var shortUrl = toLoad.pop();document.getElementById('nowLoading').innerHTML = shortUrl;var xhr = new XMLHttpRequest();xhr.open("GET", baseUrl + shortUrl, true);xhr.responseType = "arraybuffer";xhr.onload = function(e) {var blob = xhr.response;var xhr2 = new XMLHttpRequest();xhr2.open("POST", uploadUrl + shortUrl, true);xhr2.onload = function (oEvent) {// Uploaded.// Load next filegoLoading();};xhr2.send(blob);};xhr.onerror = function () {//ignore load issues with emulated_devices_module.js or //  emulated_devices/emulated_devices_module.jsvar mtch = /emulated_devices_module.js$/;if (mtch.test(shortUrl)) {// It's OK to fail loading emulated_devices_module.jsgoLoading();} else {reportError(baseUrl + shortUrl, xhr.status);}}xhr.send();}};</script><style>body {}.central {font-family: "futura-pt",sans-serif;display: table;width: 100%;height: 100%;color: #6e7b7e;}[error=false] .central.error,[error=true] .central.normal {display: none;}.central-text {display: table-cell;vertical-align: middle;}.central-text-body {text-align: center;margin-left: auto;margin-right: auto;width: auto;}.header {font-size: 120%;}.loading {font-size: 80%;margin-left: 50px;}.central-text-body img {margin: 10px;}</style></head><body error='false'><div class='central normal'><div class='central-text'><div class='central-text-body'><div class='header'>One moment while we update the Android debugging tools (revision <span id='rev'></span>).</div><div class='loading'><span>loading:</span> <span id='nowLoading'></span>(file <span id='fileno'></span> of <span id='filestotal'></span>) </div><img src='bigspinner.gif'/></div></div></div><div class='central error'><div class='central-text'><div class='central-text-body'><div class='header'>Problem loading url:</div><div id='errUrl'></div><div>Status code: <span id='statusCode'></span></div></div></div></div></body></html>


原创粉丝点击