此题正解:打开firefox, 选中菜单 File->Work Offline,之后打开api文档都是秒开了,缺点就是不能访问在线的网址. 默认菜单是隐藏的,可以移动到Tab页空白处右键Menu bar.

--------------------------------------------------------------------------------------------------------------------------------------------


场景:

1. 下载sdk时下载了docs/reference文档,文档是html形式的,因为里面带有google的相关网址,浏览器打开时会去访问这些被墙的网址,所以显示巨慢。

2. 解决办法就是遍历子目录删除google相关网址,由于是android开发,就用Java实现吧.

3.以下运行用时9分钟,i5双核,4G内存,开了其他东西,最新的sdk docs,android 5L.

4.即使删除了这些, firefox打开一个package链接还是得5秒左右.

5.有一种打开急速方式,打开firefox, 选中菜单 File->Work Offline,之后打开api文档都是秒开了,缺点就是不能访问在线的网址. 默认菜单是隐藏的,可以移动到Tab页空白处右键Menu bar.


文件.Cleaner.java


[java]view plaincopy

  1. importjava.io.*;

  2. publicclassCleaner

  3. {

  4. publicstaticvoidmain(String[]args){

  5. System.out.println("begintocleangoogle.com;googleapis.com;google-analytics.com");

  6. StringcurrentDir=args[0];

  7. Cleanerc=newCleaner();

  8. c.work(currentDir);

  9. System.out.println("endtocleangoogle.com;googleapis.com;google-analytics.com");

  10. }

  11. publicCleaner(){}

  12. publicvoidwork(StringcurrentDir){

  13. Filefile=newFile(currentDir);

  14. deleteReference(file);

  15. }

  16. publicvoiddeleteReference(Filefile)

  17. {

  18. String[]files=file.list();

  19. Stringpath=file.getPath();

  20. for(Stringone:files){

  21. StringfilePath=path+File.separatorChar+one;

  22. //System.out.println(filePath);

  23. FilefileTemp=newFile(filePath);

  24. if(fileTemp.isDirectory())

  25. {

  26. deleteReference(fileTemp);

  27. }else{

  28. //deletegooglereference

  29. if(filePath.endsWith(".html"))

  30. {

  31. try

  32. {

  33. BufferedReaderbr=newBufferedReader(newInputStreamReader(newFileInputStream(fileTemp),"UTF-8"));

  34. filePath=filePath+".tmp";

  35. FilenewFile=newFile(filePath);

  36. BufferedWriterbw=newBufferedWriter(newOutputStreamWriter(newFileOutputStream(newFile),"UTF-8"));

  37. Stringline=null;

  38. while((line=br.readLine())!=null)

  39. {

  40. StringnewLine=line.replaceAll("google\\.com|googleapis\\.com|google-analytics\\.com","");

  41. bw.write(newLine);

  42. bw.newLine();

  43. }

  44. br.close();

  45. bw.close();

  46. fileTemp.delete();

  47. newFile.renameTo(fileTemp);

  48. }catch(Exceptione)

  49. {

  50. e.printStackTrace();

  51. }

  52. }

  53. }

  54. }

  55. }

  56. }



编译执行:


[plain]view plaincopy

  1. C:\Users\Admin\Desktop>javacCleaner.java&javaCleanerE:\software\adt\sdk\docs\reference

  2. begintocleangoogle.com;googleapis.com;google-analytics.com

  3. endtocleangoogle.com;googleapis.com;google-analytics.com


补充一点会快点,但是firefox还是得要5秒,有时间再分析加载过程吧,凑合用着:

删除 sdk/docs/assets/js/docs.js里的 https://apis.google.com/js/plusone.js


更多相关文章

  1. Android(安卓)PopupWindow 弹出菜单
  2. andriod一个不错的启动菜单显示屏动画效果
  3. adb环境变量的配置
  4. Android基础知识】选项菜单、上下文菜单、子菜单的使用
  5. Ubuntu 下更新adt 的问题
  6. WebView的基本使用方法及 WebViewClient加载网页使用
  7. Android(安卓)Launcher 如何去掉主菜单,所有应用摆在桌面,类似小米
  8. Android(安卓)Activity 四种启动模式
  9. Android:Bluetooth 的打开和关闭

随机推荐

  1. android-async-http将json封装到body体中
  2. x4412开发板&ibox卡片电脑项目实战5-修改
  3. SurfaceView的使用
  4. Android术语详解
  5. layout_weight 学习笔记.
  6. Android(安卓)技术干货收集
  7. Android(安卓)源码中增加自定义系统服务
  8. 加快Android(安卓)Studio的编译速度
  9. 模拟器1.5 :Avd 创建,adb 命令攻略
  10. Android(安卓)Studio将lib项目打包成jar