Troubleshoot Android development docs Open too slow issues

Source: Internet
Author: User

There are three ways to do this:

1. Offline viewing, no networking; (as if it's useless, not very fast)

2. Use offline browsing in the browser, effective, fast. (However, the top menu does not appear.)

3. Because the Web page in the local document has the following JS code to load the information in the network, so long as it is commented out.

<src= "Http://www.google.com/jsapi"  type= "Text/javascript " ></ Script >

Use Eclipse to run the following Java code (also available on the command line)

ImportJava.io.BufferedReader;ImportJava.io.BufferedWriter;ImportJava.io.File;Importjava.io.FileNotFoundException;ImportJava.io.FileReader;ImportJava.io.FileWriter;Importjava.io.IOException;/*** Remove the JS code that needs to be networked in the Android offline document *@authorKalinarain*/ Public classFormatandroiddoc { Public Static intJ=0;  Public Static voidMain (String args[]) {File file=NewFile ("C:\\mysoftware\\androiddev\\sdk\\docs"); Searchdirectory (file,0); System.out.println ("Over"); }         Public Static voidSearchdirectory (File F,intdepth) {          if(!f.isdirectory ()) {String FileName=F.getname (); if(Filename.matches (". *.{ 1}html ") ) {String src= "< (link rel) [=]\" (stylesheet) \ "\ n (href) [=]\" (HTTP)://(FONTS.GOOGLEAPIS.COM/CSS) [?] (family) [=] (Roboto) [:] (Regular,medium,thin,italic,mediumitalic,bold) \ "(title) [=]\" roboto\ ">"; String Src1= "<script src=\" http://www.google.com/jsapi\ "type=\" text/javascript\ "></script>"; String DST= ""; //if it is an HTML file, comment out the specific JavaScript codeannotation (f, SRC, DST);              Annotation (f, src1, DST); }          } Else{file[] fs=F.listfiles (); Depth++;  for(inti = 0; i < fs.length; ++i) {File file=Fs[i];              Searchdirectory (file, depth); }          }      }        /** F is going to modify the contents of the file in which the specific content * SRC will be replaced * DST will be replaced with the content of the layer*/       Public Static voidannotation (File F, string src, string dst) {string content=Formatandroiddoc.read (f); Content=Content.replacefirst (SRC, DST); intLl=content.lastindexof (SRC);          System.out.println (LL);          Formatandroiddoc.write (content, f); System.out.println (J++); return; }         Public StaticString Read (File src) {stringbuffer res=NewStringBuffer (); String Line=NULL; Try{BufferedReader Reader=NewBufferedReader (NewFileReader (SRC)); intI=0;  while(line = Reader.readline ())! =NULL) {                  if(i!=0) {res.append (' \ n ');                  } res.append (line); I++;          } reader.close (); } Catch(FileNotFoundException e) {e.printstacktrace (); } Catch(IOException e) {e.printstacktrace (); }          returnres.tostring (); }         Public Static BooleanWrite (String cont, File dist) {Try{bufferedwriter writer=NewBufferedWriter (NewFileWriter (Dist));              Writer.write (cont);              Writer.flush ();              Writer.close (); return true; } Catch(IOException e) {e.printstacktrace (); return false; }      }}

This method is still valid, but some links may not be accessible.

4. Using the Shell code

Through the shell to delete the line JS code, very simple and convenient, than the above Java convenient 100 times times, but can not delete the first section of JS code.
Find. -name "*.html" |xargs grep-l "Jsapi" |xargs sed-i '/jsapi/d '

But there seems to be no way to compare the whole online, so I did not write

Troubleshoot Android development docs Open too slow issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.