Android-controlled adb shell (just starting to update)

Source: Internet
Author: User

The first step: First, download the Adb1.0.32.zip, inside the content:

The second step: Unzip, copy Adb.exe, and Fastboot.exe to System32, note adbwinusbapi.dll,adbwinapi.dll These two copied to the system folder, or not open!

Step three: Open the ADB, you must use CMD, otherwise flash back; use cmd to enter ADB directly;

Fourth Step: Install Android phone driver

Fifth step: Write Java code operations adb

ImportJava.io.BufferedReader;ImportJava.io.BufferedWriter;Importjava.io.IOException;ImportJava.io.InputStreamReader;ImportJava.io.OutputStreamWriter; Public classT1 { Public Static voidMain (string[] args) {Try{Process Process= Runtime.getruntime (). EXEC ("adb shell");//adb Shell        FinalBufferedWriter OutputStream =NewBufferedWriter (NewOutputStreamWriter (Process.getoutputstream ())); FinalBufferedReader InputStream =NewBufferedReader (NewInputStreamReader (Process.getinputstream ())); //It is important to pay attention to the error stream reading, otherwise it is easy to block, not get the results you want,       FinalBufferedReader Errorreader =NewBufferedReader (NewInputStreamReader (Process.geterrorstream ())); NewThread (NewRunnable () {String line;  Public voidrun () {System.out.println ("Listener Started"); Try {                      while((Line=inputstream.readline ())! =NULL) {System.out.println (line); }                 } Catch(IOException e) {//E.printstacktrace (); }} ). Start (); NewThread (NewRunnable () {FinalBufferedReader br =NewBufferedReader (NewInputStreamReader (system.in));  Public voidrun () {System.out.println ("Writer started");                 String Line; Try {                      while(Line =br.readline ())! =NULL) {Outputstream.write ( line+ "\ r \ n");                     Outputstream.flush (); }                 } Catch(IOException e) {//E.printstacktrace (); }} ). Start (); inti =process.waitfor (); System.out.println ("I=" +i); } Catch(Exception e) {e.printstacktrace (); } }}

Operation Result: Console

The instructions have been successfully executed!

Android-controlled adb shell (just starting to update)

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.