[Android]_[初级]_[sdk docs reference api 文档打开慢的解决办法]
此题正解:打开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
importjava.io.*;
publicclassCleaner
{
publicstaticvoidmain(String[]args){
System.out.println("begintocleangoogle.com;googleapis.com;google-analytics.com");
StringcurrentDir=args[0];
Cleanerc=newCleaner();
c.work(currentDir);
System.out.println("endtocleangoogle.com;googleapis.com;google-analytics.com");
}
publicCleaner(){}
publicvoidwork(StringcurrentDir){
Filefile=newFile(currentDir);
deleteReference(file);
}
publicvoiddeleteReference(Filefile)
{
String[]files=file.list();
Stringpath=file.getPath();
for(Stringone:files){
StringfilePath=path+File.separatorChar+one;
//System.out.println(filePath);
FilefileTemp=newFile(filePath);
if(fileTemp.isDirectory())
{
deleteReference(fileTemp);
}else{
//deletegooglereference
if(filePath.endsWith(".html"))
{
try
{
BufferedReaderbr=newBufferedReader(newInputStreamReader(newFileInputStream(fileTemp),"UTF-8"));
filePath=filePath+".tmp";
FilenewFile=newFile(filePath);
BufferedWriterbw=newBufferedWriter(newOutputStreamWriter(newFileOutputStream(newFile),"UTF-8"));
Stringline=null;
while((line=br.readLine())!=null)
{
StringnewLine=line.replaceAll("google\\.com|googleapis\\.com|google-analytics\\.com","");
bw.write(newLine);
bw.newLine();
}
br.close();
bw.close();
fileTemp.delete();
newFile.renameTo(fileTemp);
}catch(Exceptione)
{
e.printStackTrace();
}
}
}
}
}
}
编译执行:
[plain]view plaincopy
C:\Users\Admin\Desktop>javacCleaner.java&javaCleanerE:\software\adt\sdk\docs\reference
begintocleangoogle.com;googleapis.com;google-analytics.com
endtocleangoogle.com;googleapis.com;google-analytics.com
补充一点会快点,但是firefox还是得要5秒,有时间再分析加载过程吧,凑合用着:
删除 sdk/docs/assets/js/docs.js里的 https://apis.google.com/js/plusone.js
更多相关文章
- Android(安卓)PopupWindow 弹出菜单
- andriod一个不错的启动菜单显示屏动画效果
- adb环境变量的配置
- Android基础知识】选项菜单、上下文菜单、子菜单的使用
- Ubuntu 下更新adt 的问题
- WebView的基本使用方法及 WebViewClient加载网页使用
- Android(安卓)Launcher 如何去掉主菜单,所有应用摆在桌面,类似小米
- Android(安卓)Activity 四种启动模式
- Android:Bluetooth 的打开和关闭