【发布时间】:2014-09-09 10:14:40
【问题描述】:
问题是:我无法使用 Chromes DevTools (chrome://inspect/#devices) 查看 CrossWalk WebView 的内容。既不是本地网站(如下图),也不是像 google.com 这样的外部网站。但它适用于独立的 chrome.apk。
配置: Chrome for Linux v. 37.0.2062.94
人行横道预构建:crosswalk-webview-9.38.199.0-arm
安卓4.4.2/4.0.3
亚行调试工作正常。 Javascript 控制台日志正在运行。 我可以在手机上看到该页面。
创建网页视图
public class CrosswalkActivity extends Activity {
private final String TAG = "CrosswalkActivity";
private XWalkView xWalkView;
public static Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
context = getApplicationContext();
super.onCreate(savedInstanceState);
setContentView(R.layout.xwalkview);
xWalkView = (XWalkView) findViewById(R.id.xWalkView);
String index = FileManager.getAssetPath(context, "index.html");
Log.i(TAG, "Loading: " + index);
this.configureWebView();
xWalkView.load("file://" + index, null);
}
private Boolean configureWebView() {
try{
xWalkView.addJavascriptInterface(new JSInterface(CrosswalkActivity.context),"JSInterface");
xWalkView.setKeepScreenOn(true);
XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
return true;
}
catch(Exception e){
Log.e(TAG, e.getMessage());
return false;
}
}
}
【问题讨论】:
-
所以,我找到了一个解决方案:您可以使用 release stable v7 或 beta 8 检查代码并以完全相同的方式初始化活动。但仍然无法使用 canary v9。
标签: android google-chrome debugging crosswalk-runtime