If you turn on "ADB over Network" on your Nexus 4 and try to connect on your Nexus 7 you will run into a small problem. The device will get connected but you will be unable to use ADB because of the RSA Authorization failing. This guide will help fix that that problem.
I am no hacker/developer. This is just to share my experience. I am not responsible if you mess your device up.
Perquisites (what I used):
Nexus 7 (rooted) Android 4.3.1
Nexus 4 (rooted) OmniRom Android 4.4.2
Windows PC w/ AndroidSDK
(you only need adb.exe)
Android Terminal Emulator installed on both devices. Available on Playstore
Open Android Terminal Emulator on the Nexus 7.
HOME=/sdcard adb start-server
This will create two files in the “/sdcard/.android/” directory on the Nexus 7. We need to transfer the “adbkey.pub” to the Nexus 4.
Connect the Nexus 7 to the computer and run the “adb.exe”. The following code will download the key to the “adb.exe” directory.
adb pull /sdcard/.android/adbkey.pub
Then disconnect the Nexus 7 and connect the Nexus 4. Then we send the file using “adb” using the push command. I am putting the file in the “/sdcard”
adb push adbkey.pub /sdcard
Now you can either use Android Terminal Emulator on your Nexus 4(which is what I did) or “adb shell” on your computer. Simply append the key to the “adb_key”
cat /sdcard/adbkey.pub >> /data/misc/adb/adb_key
To start ADB over Network on Nexus 4
setprop service.adb.tcp.port 5555
On the Nexus 7 connect to phone ip address. If you don’t know what that is head over to Settings>Wi-fi >Advanced Wi-fi >Scroll down to IP Adress . Lets assume its 192.168.1.100
adb connect 192.168.1.100
If you get a ‘Allow USB Debugging ?’ alert on your phone click ‘OK’. Now you can use adb commands . If you can help me improve this guide let me know in comments. This is my first guide. I am no expert in android but I will try to answer your questions.
Remember to switch off "ADB over Network" on Nexus 4
setprop service.adb.tcp.port -1
To check "ADB over Network"