jadb/README.md

106 lines
4.2 KiB
Markdown
Raw Permalink Normal View History

2017-04-16 21:49:54 +02:00
# JADB #
2013-07-25 20:48:46 +02:00
ADB client implemented in pure Java.
The Android Debug Bridge (ADB) is a client-server architecture used to communicate with Android devices (install APKs, debug apps, etc).
2013-07-25 20:48:46 +02:00
The Android SDK Tools are available for the major platforms (Mac, Windows & Linux) and include the `adb` command line tool which implements the ADB protocol.
2013-07-25 20:48:46 +02:00
This projects aims at providing an up to date implementation of the ADB protocol.
2013-07-25 21:56:30 +02:00
2022-02-08 17:16:53 +01:00
![Build Status](https://github.com/vidstige/jadb/actions/workflows/maven.yml/badge.svg)
[![jitpack badge](https://jitpack.io/v/vidstige/jadb.svg)](https://jitpack.io/#vidstige/jadb)
2017-10-22 19:36:34 +02:00
[![codecov](https://codecov.io/gh/vidstige/jadb/branch/master/graph/badge.svg)](https://codecov.io/gh/vidstige/jadb)
2022-02-08 17:16:53 +01:00
[![first timers friendly](http://img.shields.io/badge/first--timers--only-friendly-green.svg?style=flat&colorB=FF69B4)](http://www.firsttimersonly.com/)
2017-10-14 22:06:27 +02:00
2016-03-02 21:55:05 +01:00
2013-07-25 21:56:30 +02:00
## Example ##
Usage cannot be simpler. Just create a `JadbConnection` and off you go.
```java
JadbConnection jadb = new JadbConnection();
List<JadbDevice> devices = jadb.getDevices();
```
2014-03-20 11:40:28 +01:00
Make sure the adb server is running. You can start it by running `adb` once from the command line.
2013-07-25 21:56:30 +02:00
It's very easy to send and receive files from your android device, for example as below.
```java
JadbDevice device = ...
device.pull(new RemoteFile("/path/to/file.txt"), new File("file.txt"));
```
Some high level operations such as installing and uninstalling packages are also available.
```java
JadbDevice device = ...
new PackageManager(device).install(new File("/path/to/my.apk"));
```
2013-07-25 21:56:30 +02:00
## Protocol Description ##
2017-10-19 21:27:58 +02:00
An overview of the protocol can be found here: [Overview](https://android.googlesource.com/platform/system/adb/+/master/OVERVIEW.TXT)
2013-07-25 21:56:30 +02:00
A list of the available commands that a ADB Server may accept can be found here:
2017-10-19 21:27:58 +02:00
[Services](https://android.googlesource.com/platform/system/adb/+/master/SERVICES.TXT)
2018-08-06 13:30:31 +02:00
The description for the protocol for transferring files can be found here: [SYNC.TXT](https://android.googlesource.com/platform/system/adb/+/master/SYNC.TXT).
2013-07-25 21:56:30 +02:00
## Using JADB in your application ##
2016-05-23 16:14:30 +02:00
Since version v1.1 Jadb support [maven](https://maven.apache.org/) as a build system. Although this project is not presented in official apache maven
repositories this library can be used as dependencies in your maven/gradle project with the help of [jitpack](https://jitpack.io).
2016-07-28 22:29:51 +02:00
[Jitpack](https://jitpack.io) is a system which parses github public repositories and make artifacts from them.
You only need to add [jitpack](https://jitpack.io) as a repository to let maven/gradle to search for artifacts in it, like so
```
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
```
After that you will need to add actual dependency. [Jitpack](https://jitpack.io) takes groupId, artifactId and version id from repository name,
2016-07-28 22:29:51 +02:00
project name and tag ignoring actual values from pom.xml. So you need to write:
```
<dependency>
<groupId>com.github.vidstige</groupId>
<artifactId>jadb</artifactId>
2021-03-05 16:40:24 +01:00
<version>v1.2.1</version>
</dependency>
```
## Troubleshooting
If you cannot connect to your device check the following.
- Your adb server is running by issuing `adb start-server`
- You can see the device using adb `adb devices`
If you see the device in `adb` but not in `jadb` please file an issue on https://github.com/vidstige/jadb/.
### Workaround for Unix Sockets Adb Server
Install `socat` and issue the following to forward port 5037 to the unix domain socket.
```bash
socat TCP-LISTEN:5037,reuseaddr,fork UNIX-CONNECT:/tmp/5037
```
## Contributing ##
2016-07-28 22:42:58 +02:00
This project would not be where it is, if it where not for the helpful [contributors](https://github.com/vidstige/jadb/graphs/contributors)
supporting jadb with pull requests, issue reports, and great ideas. If _you_ would like to
contribute, please read through [CONTRIBUTING.md](CONTRIBUTING.md).
2020-09-25 11:14:41 +02:00
* If you fix a bug, try to _first_ create a failing test. Reach out to me for assistance or guidance if needed.
## Authors ##
2017-10-19 21:22:55 +02:00
Samuel Carlsson <samuel.carlsson@gmail.com>
See [contributors](https://github.com/vidstige/jadb/graphs/contributors) for a full list.
## License ##
This project is released under the Apache License Version 2.0, see [LICENSE.md](LICENSE.md) for more information.