Is there any tool out which runs an apk on a real mobile device, like an emulator. The tool would need to execute the apk properly, but also be able to intercept certain commands. Any chance?
To make it more clear, I dont need a shell command to start and stop or so. I need more of a container emulator like tool, which might be able to inject/alter running compiled code.
The ADB connects to running devices, those are:
Running emulators;
Devices connected trough USB that have "Developer options on"+"USB debugging" on device enabled
Also, you need to accept in the device the key for debugging trough ADB after connecting.
Obs: Drivers may be necessary for the device, (google has a package in SDK manager with Google Drivers that works for some devices too)
Related
I have a OnePlus X device, which I use with Eclipse for debugging my apps. I had a Nexus 4 which worked perfectly.
I have a late-2012 macbook pro, and I tried to plug my device directly in the usb port of the computer, and with an external alimented hub.
When I plug my OnePlus and I use the command "adb devices" I can see my device. Troubles comes when I run the Android app from eclipse... At this point, my device is disconnected and the app is not launched. And I can't see my device anymore with adb device. All I can do is restarting the adb server, but it will still disconnect after I tried to run the app in Eclipse
I tried different cables, different usb in, but nothing change.
Anyone has a solution ?
I'm developing a Cordova Plugin for Android that interacts with a printer connected to my Android device's USB port. I also have Ionic in the mix running a working Anular application. I have the Plugin working, but getting to that point was painful. There were many iterations of deploying the app from my laptop (using ionic run Android) swapping the otg cable out and pluging in the printer and testing.
I'm looking for a better develop/debug story. I'm planning to add additional features to the Cordova plugin and would like to find a cable configuration that lets me keep the Android device connected to my laptop while the printer is also connected the Android device.
I've tried a few different after market cables, but everything seem to only support charging the device while connected to the peripheral devices. Nothing seems to allow me to stay connected to the laptop and have a peripheral connected simultaneously.
Is anyone aware of a USB Hub, Switch or Router that could help ease my pain, or have suggestions on how I can easily debug my Java based plugin while it is connected to the USB printer. At a minimum I'd like to be able to attach a debugger to my plugin and step through the Java code.
Using an Emulator is out of the question because the performance is simply unbearable.
Sorry in advance if this question is not appropriate here.
I think I have a better solution for you, you can deploy to your device using adb over Wi-fi and keep your printer cable connected to test your app, here is how:
Connect your android device to your computer using a USB cable
From a command line run adb tcpip 1234 // or any port of your chosing
disconnect your android USB cable
run adb connect <your-phone-ip>:1234
Connect your printer using the USB cable
run ionic run android to deploy your app.
I just tested this combo with a Mac and an Android Nexus 5 and it works like a charm.
I'm developing an enterprise app in PhoneGap, and I want to work offline with some data, and through a plugin (with code written in Java) send the processed data back over the LAN Network (when this were detected), but I need some code samples to create a reverse tethering without rooting the device nor using external apps.
I'm trying to avoid creating a local component in the windows machine, I want to send the data directly using REST commands.
Any code samples or suggestions are welcome.
Have you tried this simple solution
For Windows: Install USB drivers from Android SDK
Connect USB cable and activate USB Tethering. You should see on linux or windows a new network interface.
On windows, Bridge the 2 network interfaces
Setup usb0 interface of your phone. You have two options:
From your computer, execute:
./adb shell netcfg usb0 dhcp
Or in a terminal on your phone, type:
su
netcfg usb0 dhcp
You should now be able to connect to Internet on your phone using your computer’s Internet connection.
http://acetips.wordpress.com/2011/10/07/reverse-usb-tethering/ and
http://blog.mycila.com/2010/06/reverse-usb-tethering-with-android-22.html
for run adb command from your android application you could use
String exeeCmd = "netcfg usb0 dhcp";
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec(exeeCmd);
} catch (IOException e) {
e.printStackTrace();
}
apply required permitions
I know this comes quite late, but it seems no real solution has been found yet, and this might help fellow readers:
As I could not find any solution myself, I have developed an app that offers Reverse Tethering for unrooted Android devices running Android 4.0 or higher. All major desktop operating systems are supported.
The app is available on Google Play: https://play.google.com/store/apps/details?id=com.floriandraschbacher.reversetethering.free
Maybe you could integrate reverse tethering tools tools into your app
I have a problem when I want to debug my application from eclipse using device (I use 9700 for debugging). It's used to be like this: the device is connected to Mac using usb cable, and automatically desktop manager pops up, gives sign that my device is successfully connected, thus I can debug my project from eclipse.
Now I can't do it like that anymore. when I connect the device to Mac, desktop manager (or Mac) doesn't detect my device. I use:
Desktop Manager 2.3.1 build 5
BlackBerry Java Plug-in Version: 1.5.2.201204302029
Does anybody know how I can make my device be detected again by the system?
You might compare the results from either of these two USB utilities:
/Applications/Utilities/System Profiler.app
/Developer/Applications/Utilities/USB Prober.app
I have to create a desktop application to syncronize apps between the PC and the Android device (a tablet in this case)
The sync will be quite basic, I need to copy a few files. But also, if the tablet doesn't have my app, the desktop app should be able to install the apk to the tablet.
I have searched all over and the only pointer I found is mention to a ddmlib (an AndroidDebugBridge library) that I can use, but I haven't found where to find it or how to use it.
So the question how I can work with ddmlib? or if there are other options to sync my Desktop app with my Android app?
Thanks in advance for your time
If I was writing your sync software, I would use adb commands to install the application on the phone, then use adb forward to create tcp/ip connection to the phone and use that connection to transmit whatever data your application would like to send back and forth, probably even encrypting the traffic.
I would advise against using adb for data transfers, because it would not read or write your application private files, where all the secrets are kept, and sending the data to the world-readable /sdcard is bad for two reasons:
it's world-readable and -writeable, your data will be exposed to everyone
some devices just don't have /sdcard or have it unmounted or unavailable for other reasons
ps. For bonus points, you may try not to use adb commands, but access the adb server directly (it usually listens on the local TCP port 5037).
With the android debug bridge you need to run:
adb push <local> <remote>
to copy to the device,
adb pull <remote> [<local>]
to copy from device or
adb install [-l] [-r] [-s] <file>
to install an apk on the device.