[آموزش] راه اندازی ADB و fastboot (ویندوز و مک)
به نام خدا
در بسیاری از تاپیک ها مشاهده می کنید که در مورد ADB و fastboot و استفاده از اونها صحبت شده. در این تاپیک یاد می گیریم چطور این دو را روی PC و گوشی خود فعال کنیم.
ADB یا Android Debugging Bridge پل ارتباطی ای هست که به شما امکان میده گوشی رو از طریق PC کنترل کنید و دستورات رو به گوشی ارسال کنید.
fastboot معمولا در بوت لودر استفاده میشه و در عملیات های متعددی از جمله آنلاک کردن و فلش کردن کرنل استفاده میشه.
لطفا بدون ذکر نام انجمن تخصصی موبایل - سیاره پی دی ای در سایت های فارسی زبان منتشر نشود.
راه اندازی ADB:
- فایل زیر را دانلود کرده و در مسیر C:\SDK\platform-tools اکسترکت کنید (باید این فولدرها را بسازید)
- یک command prompt باز کنید. برای این کار در منوی start ویندوز تایپ کنید cmd.
- دستورات زیر را تایپ کنید.
| >_
cd C:\SDK\platform-tools
adb.exe | |
- باید اطلاعات زیر را مشاهده کنید.
کد:
Android Debug Bridge version 1.0.29
-d - directs command to the only connected USB devic
e
returns an error if more than one USB device is
present.
-e - directs command to the only running emulator.
returns an error if more than one emulator is r
unning.
-s <serial number> - directs command to the USB device or emulator w
ith
the given serial number. Overrides ANDROID_SERI
AL
environment variable.
-p <product name or path> - simple product name like 'sooner', or
a relative/absolute path to a product
out directory like 'out/target/product/sooner'.
If -p is not specified, the ANDROID_PRODUCT_OUT
environment variable is used, which must
be an absolute path.
devices - list all connected devices
connect <host>[:<port>] - connect to a device via TCP/IP
Port 5555 is used by default if no port number
is specified.
disconnect [<host>[:<port>]] - disconnect from a TCP/IP device.
Port 5555 is used by default if no port number
is specified.
Using this command with no additional arguments
will disconnect from all connected TCP/IP devic
es.
device commands:
adb push <local> <remote> - copy file/dir to device
adb pull <remote> [<local>] - copy file/dir from device
adb sync [ <directory> ] - copy host->device only if changed
(-l means list but don't copy)
(see 'adb help all')
adb shell - run remote shell interactively
adb shell <command> - run remote shell command
adb emu <command> - run emulator console command
adb logcat [ <******-spec> ] - View device log
adb forward <local> <remote> - forward socket connections
forward specs are one of:
tcp:<port>
localabstract:<unix domain socket name>
localreserved:<unix domain socket name>
localfilesystem:<unix domain socket name>
dev:<character device name>
jdwp:<process pid> (remote only)
adb jdwp - list PIDs of processes hosting a JDWP transport
adb install [-l] [-r] [-s] <file> - push this package file to the device and i
nstall it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data
)
('-s' means install on SD card instead of inter
nal storage)
adb uninstall [-k] <package> - remove this app package from the device
('-k' means keep the data and cache directories
)
adb bugreport - return all information from the device
that should be included in a bug report.
adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|-nosy
stem] [<packages...>]
- write an archive of the device's data to <file>
.
If no -f option is supplied then the data is wr
itten
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks
themselves
in the archive; the default is noapk.)
(-shared|-noshared enable/disable backup of the
device's
shared storage / SD card contents; the defau
lt is noshared.)
(-all means to back up all installed applicatio
ns)
(-system|-nosystem toggles whether -all automat
ically includes
system applications; the default is to inclu
de system apps)
(<packages...> is the list of applications to b
e backed up. If
the -all or -shared flags are passed, then t
he package
list is optional. Applications explicitly g
iven on the
command line will be included even if -nosys
tem would
ordinarily cause them to be omitted.)
adb restore <file> - restore device contents from the <file> backup
archive
adb help - show this help message
adb version - show version num
scripting:
adb wait-for-device - block until device is online
adb start-server - ensure that there is a server running
adb kill-server - kill the server if it is running
adb get-state - prints: offline | bootloader | device
adb get-serialno - prints: <serial-number>
adb status-window - continuously print device status for a specifie
d device
adb remount - remounts the /system partition on the device re
ad-write
adb reboot [bootloader|recovery] - reboots the device, optionally into the boo
tloader or recovery program
adb reboot-bootloader - reboots the device into the bootloader
adb root - restarts the adbd daemon with root permissions
adb usb - restarts the adbd daemon listening on USB
adb tcpip <port> - restarts the adbd daemon listening on TCP on th
e specified port
networking:
adb ppp <tty> [parameters] - Run PPP over USB.
Note: you should not automatically start a PPP connection.
<tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1
[parameters] - Eg. defaultroute debug dump local notty usepeerdns
adb sync notes: adb sync [ <directory> ]
<localdir> can be interpreted in several ways:
- If <directory> is not specified, both /system and /data partitions will be u
pdated.
- If it is "system" or "data", only the corresponding partition
is updated.
environmental variables:
ADB_TRACE - Print debug information. A comma separated list
of the following values
1 or all, adb, sockets, packets, rwx, usb, sync
, sysdeps, transport, jdwp
ANDROID_SERIAL - The serial number to connect to. -s takes prior
ity over this if given.
ANDROID_LOG_TAGS - When used with the logcat option, only these de
bug tags are printed.
- گوشی را به PC متصل کنید. باید USB Debugging در منوی settings فعال شده باشد. برای این کار در رامهای GB به منوی Settings - Applications - Development بروید و در رامهای ICS و HC به منوی Settings - Developer Options بروید.
- دستور زیر را تایپ کنید.
- باید چنین اطلاعاتی مشاهده کنید.
کد:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
Device name
- در صورتیکه نام گوشی نمایش داده شده یعنی همه چیز درسته.
- دستورات زیر، دستورات متداول در استفاده از ADB است.
کد:
adb reboot
adb reboot recovery
adb reboot bootloader
adb push C:\<directory>\file /sdcard/
adb pull /sdcard/file C:\<directory>\
adb install C:\<directory>/file.apk
or /sdcard/<directory>/file.apk
adb remount
- دستورات زیر هم که ADB shell نامیده می شوند برای استفاده از دستورات خود گوشی کاربرد دارند.
کد:
adb shell
#mv /sdcard/file /system/app
#cp /sdcard/file /system/app
#rm /sdcard/file
#mkdir /sdcard/yourfoldernamehere
#ls /sdcard/<directory>
راه اندازی Fastboot:
- گوشی باید در حالت بوت لودر باشه.
- دستور زیر را در command prompt بزنید.
| >_
cd C:\SDK\platform-tools
| |
- دستورات زیر در fastboot استفاده می شوند.
کد:
fastboot devices – lists which devices in fastboot mode are currently attached to your computer
fastboot boot <filename> – boots a rom stored on your pc specified by the filename
fastboot flash <partition> <filename> – flashes a rom stored on your pc, partition can be one of {boot, recovery, system, userdata}
Example: fastboot flash recovery C:\<directory>\recovery.img
منبع : [Only registered and activated users can see links. Click Here To Register...] از XDA
راه اندازی ADB و Fastboot بر روی سیستم عامل Mac
به نام خدا
راه اندازی ADB و Fastboot بر روی سیستم عامل Mac
ابتدا بک فولدر به نام android ایجاد کنید. این فولدر میتونه در هر جایی قرار بگیره بنابراین برای راحتی کار می تونید روی دسکتاپ قرارش بدید.
سپس از [Only registered and activated users can see links. Click Here To Register...]android SDK را دانلود کنید. (بر خلاف سیستم های ویندوزی نیازی به نصب جاوا نیست اما پیشنهاد میشه جاوا رو هم نصب کنید)
وقتی که دانلود تمام شد، محتویات فایل android-sdk-mac_x86 را درون فولدر androidای که قبلا ساختید، بریزید.
وارد فولدر android شوید و سپس وارد فولدر tools شده و فایلی که به اسم adnroid یا android sdk هست را اجرا کنید.
وقتی که این فایل باز شد، فولدر tools را چک کنید تا هر دو فولدر Android SDK Tools و Android SDK Platform-tools انتخاب شده باشند. install را کلیک کرده و منتظر دانلود شدن آنها باشید.
حال وارد فولدر platform-tools در فولدر android خودتون بشید و فایلهای adb و fastboot را درون فولدر adnroid خودتون کپی کنید.
حال چک می کنیم که adb و Fastboot درست کار کنند.
در رامهای Gingerbread و پایین تر، وارد منوی Settings و سپس Apps و سپس Developer شده و USB Debugging را فعال کنید.
در رامهای ICS و JB باید وارد منوی Settings و سپس Developer Options شده و این گزینه را فعال کنید.
حالا گوشی رو با USB به کامپیوترتون وصل کنید.
حال در کامپیوتر Macتون یک Terminal باز کنید و به جایی که فولدر adnroid رو ایجاد کردید، برید. مثلا اگر این فولدر روی Desktop باشد، باید دستور زیر را تایپ کنید.
| >_
cd /Users/<yourusername>/Desktop/android | |
حال دستور زیر را تایپ کنید.
بعد از زدن Enter باید serial number گوشیتون رو ببینید.
در صورتیکه این اتفاق افتاد، adb و fastboot شما کاملا درست کار خواهند کرد.