Newer adb for Ubuntu, with sideloading
Posted by Aapo Rantalainen on March 4, 2015
Android debugging tool ADB has ‘new‘ feature called sideload, which is in use on Android devices, but not all versions of host toolset. Here comes instructions for compiling newest version from source.
Adb (Android Debug Bridge) is debugging tool to communicate with Android-device and host.
Some people follow instructions and then encounters mystic error:
adb “*cannot read ‘sideload’ *”
adb in your system is too old. E.g. you are using Ubuntu/Debian and your adb comes from package android-tools-adb.
Compile your own adb (doesn’t need full Android SDK).
#Needed tools sudo apt-get install zlib1g-dev libssl-dev git make gcc #Download source code (this is currently the newest branch, in future it might still work without issues) git clone -b android-5.0.2_r1 https://android.googlesource.com/platform/system/core cd core/adb #Create Makefile echo -e ' # standalone Makefile for adb SRCS+= adb.c SRCS+= fdevent.c SRCS+= adb_client.c SRCS+= commandline.c SRCS+= console.c SRCS+= file_sync_client.c SRCS+= get_my_path_linux.c SRCS+= services.c SRCS+= sockets.c SRCS+= transport.c SRCS+= transport_local.c SRCS+= transport_usb.c SRCS+= usb_linux.c SRCS+= usb_vendors.c SRCS+= adb_auth_host.c VPATH+= ../libcutils SRCS+= socket_inaddr_any_server.c SRCS+= socket_local_client.c SRCS+= socket_local_server.c SRCS+= socket_loopback_client.c SRCS+= socket_loopback_server.c SRCS+= socket_network_client.c SRCS+= load_file.c VPATH+= ../libzipfile SRCS+= centraldir.c SRCS+= zipfile.c CPPFLAGS+= -DADB_HOST=1 CPPFLAGS+= -DHAVE_FORKEXEC=1 CPPFLAGS+= -DHAVE_SYMLINKS CPPFLAGS+= -DHAVE_TERMIO_H CPPFLAGS+= -DHAVE_SYS_SOCKET_H CPPFLAGS+= -DHAVE_OFF64_T CPPFLAGS+= -D_GNU_SOURCE CPPFLAGS+= -D_XOPEN_SOURCE CPPFLAGS+= -I. CPPFLAGS+= -I../include LIBS= -lcrypto -lpthread -lrt -lz CC= gcc LD= gcc OBJS= $(SRCS:.c=.o) all: adb adb: $(OBJS) \t$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) clean: \trm -rf $(OBJS) adb ' > standalone_Makefile #Compile make -f standalone_Makefile #Profit ./adb sideload foobar
Adb can be tested without device connected, and with dummy filename. Error message should be then:
* cannot read 'foobar' *
Makefile starting point: http://android.serverbox.ch/?p=1217
More to read
Adb sideload feature is added:
commit 447f061da19fe46bae35f1cdd93eeb16bc225463 Author: Doug Zongker Date: Mon Jan 9 14:54:53 2012 -0800</code> add "adb sideload" and sideload connection state Recovery will soon support a minimal implementation of adbd which will do nothing but accept downloads from the "adb sideload" command and install them. This is the client side command (mostly resurrected out of the old circa-2007 "adb recover" command) and the new connection state. Change-Id: I4f67b63f1b3b38d28c285d1278d46782679762a2
But it is still not documented: https://code.google.com/p/android/issues/detail?id=158394