Android: How to run/debug/test android app on tab? - android

I'm a novice in android app development (using Android Studio) and want to make an app and all set for go on but I have an issue and that is how can I run my app on my tab for test purpose as you know android emulator is slow (very slow). I had checked some answer but all are for window specific and I have Linux operating system.
I have a tablet (not rooted).
Usb cable.
wifi connection.
I need a way where I don't have to root my tablet and work on Linux too.
Thank you in advance

When you insert the cable of the tablet, linux should recognize it, if is not recognized you may install a driver.You can run the command:
$ lsusb
After that when appears the screen after you press run in AS, just select the device instead of the emulator.
If does not work, it could be that your tablet in development options ( psychically you have to interact with your tablet) does not have checked the option debug( on default is not activated), on some devices you have to look in the internet how to access to this option.
A last recommendation is to check in the manifest and in the build.gradle( take care there are two of them) that debbugable is set as true

Related

Test android app on Virtual Box from Android studio

I have a very specific problem. I am trying to create an Android app for educational purposes, together with a friend of mine. The problem is, my processor does not support VT-x, which is essential for using an AVD, and my Android phone is considerably old so it can't really take much.
Therefore, the one solution I have in mind is using VirtualBox to create a 32-bit Android Virtual Machine and test my app there.
The problem is that, unlike an actual Android device and an AVD, a VirtualBox Android VM does not have, for what my knowledge is, an obvious way of being connected with Android Studio for testing each new app build.
So, what I am asking for is exactly that: a way to immediately test the app I have written in Android Studio in my Android Virtual Machine I have created on VirtualBox, including any workarounds that effectively allow me to immediately test the app on the VM, other than finding a way to make adb work with it.
I see I'm a bit late on this one but I figured it out. I am using Windows 8, running Android x86 (4.4 r1) on VirtualBox.
1. Set up a Host-Only adapter so that the VM has access to your network; You can set this up only when the Android image is off. Basically just go into your settings, click on Network, and select Host-Only Adapter in the drop-down labeled Attached to. For Adapter Type select PCnet-FAST III. Check the box next to Cable Connected if it isn't already.
2. Set up an NAT Adapter by selecting a different Adapter tab and for Attached to select NAT. For Adapter Type select PCnet-FAST III again. Check the box next to Cable Connected if it isn't already.
3. Enable Developer Mode by starting up the Android image, then going to Settings > About phone/tablet > Build Number. Click on Build Number 7 times. You should see a pop up that tells you how many more times you need to click to get into Developer mode. Credit to RMP PianoTuning's answer below
4. Get the virtual Android's IP address by going into Settings > About phone/tablet > Status > and then scrolling down until you find your local IP Address. Remember this number, you'll need it for the next step.
5. Start up Android Studio and go into the console; it should be one of the options in the bottom-left corner. Type in adb connect (IP address from step 4). Take a deep breath and hit enter. If it says
connected to (IP address)
you are ready to rock! When you run the app within Android Studio, your virtual Android should appear as Innotek GmbH VirtualBox, or something like the same. Select that puppy and enjoy your new, easy-to-test-on emulator. Its even Bluetooth Compatible! (but thats a whole 'nother story... google it)
Now a virtualbox isn't an answer to your need.
here are some alternatives,
Genymotion http://www.genymotion.com/ which is an easy to use android emulator , i suggest you look into it. based on virtualbox , can be integrated into android studio with ease . needs an AMD-V proc if not a VT-x . If the processor does not support these, the emulator still works, but your emulated device will only be able to use one CPU.
The other option is adb over wifi, which will let you use your phone without doing the dropbox step http://forum.xda-developers.com/showthread.php?t=1685736. For this to work you will need root though.
I was able to follow OMiKeY steps and get my app to run in VirtualBox,
the part he leaves out:
In your Android simulated device, you have to enable Developer mode.
Goto 'Settings' -> About Phone/Tablet->Build Number.
click on Build Number 7 times.
For me I got pop up that told me how many more times I needed to click to get into Developer mode.
After that i re ran the adb connect XXX.XXX.XXX.XXX command
Here's how it works for me.
I just connect my android phone with USB to my host (Windows 10).
Then make sure the USB phone is found from within the guest OS (ubuntu desktop 18.04 in VirtualBox 6.0). (VirtualbBox app: Devices > USB > check the USB corresponding to my phone). Once it's recognized by ubuntu, there will be a phone icon showing up on the desktop screen.
Next, I start android studio (v3.3.2); once that is complete, from the Terminal window (Android studio: View > Tool Windows > Terminal), I type in: adb devices, which would list the devices attached and my phone is on the list.
Now I run the app for a test (monitor my phone and confirm if there's prompt)...and the app shows up on my phone. Hope this may of help for others.
If you are running Windows, open the specific port in Firewall. In VirtualBox in your Android instalation Settings->Network Adapter 2 Tab - Port Fowarding and create a rule with Protocol (TCP) - Host IP (Your IP) - Host Port (in my case 5555) - Guest IP (Same Step 4 - Check your IP ) - Guest Port (I put the 5555 too). Ok! Now I can run my Apps in VM.
AppData\Local\Android\Sdk\platform-tools>adb connect 192.168.0.101
connected to 192.168.0.101:5555
Running devices:
innotek GmbH VirtualBox
:-)

USB Debugging in VitualBox-hosted Android system

I have set up a virtual machine running an Android 4.4 system on VirtualBox, in a Windows 7 system, for convenience in testing an Android app I am trying to develop. What last remains, is to be able to make the guest Android OS look like it's connected to the host via USB, to be able to use USB Debugging. Is there a way to achieve that?
EDIT: By "convenience" I mean I do not have a good enough physical device at my hands at the moment, and my processor happens not to support VT-x, in which case I could just use an AVD with Android Studio. Therefore, the VirtualBox choice is the next best thing I got, until I get a new device on my hands. What has priority at the moment is to create the app's utility, looks will be taken care of later on.
If your Android system is rooted you can install Wifi ADB (or some similar application) through Android Play store and debug over TCP.
The steps can be simply:
Install Wifi ADB (from https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es)
Execute and start service (Bettle will go to green)
Open Command line in Windows 7 machine
Run the connection command, for example:
adb connect 192.168.125.232
Test device connection with
adb devices
Enjoy testing your application!

Android device disappearing from list, doesn't matter WiFi or USB debuggings

Eclipse started to driving me crazy.
While I was debugging via USB , my device was disappearing from Device Chooser dialog box list after every debugging session (same issue with this) I've tried to reset adb but nothing changed.
And then I decided to use debugging via WiFi. So I made all configuration as mentioned in adb help, successfully. After that, in my first try it worked like a charm but after debugging session it's disappered from device chooser list again. But it's appearing in DDMS tab and adb devices command.
It's ok in adb devices
also in DDMS
But when I try to run application
where is my device?!
Yes my device's Android API level is bigger than 11 and ADB over Network option is checked in device settings.
(I'm sure this problems are not about my USB cable or my device because I've tried them with 2 different USB cable and 2 different Android device -Galaxy S2 and XPeria Z3-. I also tried to reinstall different versions of Eclipse)
Is it time to start using Android Studio? Do you have any idea about fixing this problem? I've tried lots of things. I'm familiar with Eclipse's interface and want to keep continue using it.

Eclipse does not see my Toshiba Folio 100 Android 2.2 tablet

After a) growing tired of the slowness of the emulator and b) nearing the end of the development of my first android app, I decided to connect my old and forgotten Toshiba Folio 100 android 2.2 tablet to my Windows 7 development PC, in order to deploy my android app. The PC and tablet 'see' each other, that is, the PC sees the tablet as a disk drive. In the android settings I switched on the developer mode. I read through the many advice threads of this site concerning deploying the app to a real device. To start with, in windows explorer, computer, right click, manage, does not result in recognition of the tablet, except for Toshiba storage USB device.
In Eclipse I went to Run configurations, target tab,tried all the different radio buttons settings, to no avail. The devices view, same story. Eclipse does not see the tablet. I also tried some old Archos 48 mini tablet, again nothing.
What can I do?
Thanks in advance.
do you see it as an android device? open a command prompt and type "adb devices" make sure your tablet is listed there, otherwise you need to find some adb drivers for it, you may want to try the generic adb usb driver.
If you're seeing the device in explorer listed as a disk drive it probably means you have the wrong USB mode on the device. It's called different things on different devices, but on many devices it's referred to as "Charge Only" mode (or not mass storage mode). Also make sure USB debugging is enabled on the device.

Android: Fast way to "test" app

i m starting (or at least trying to) developing android application(s) and I m using eclipse for it along the android sdk.
Now I m wondering if there's a faster way to "test" and tryout something newly writen in the code than starting it in the emulator?
I'm wondering because I m running on 8gb ram and q9550 (quadcore) and it takes some time (let's say 20secs) to upload and start the apk and now
I'm wondering if this really is the only way to test since it requires huge amount of time, especially when I'm trying something new which doesn't work and thus I'm always gotta run it like this let's say like 20 times until I figure out what's wrong with my code...
You can connect your android phone using USB debugging mode and debug your code. If you can't do that, you can export an apk file (which is quick) and use dropbox/gmail to send it to your phone. I am not a big fan of emulator :)
Here's how to enable usb debugging
http://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/
I would recommend running on your device rather than the emulator.
http://developer.android.com/tools/device.html
In short:
Turn on "USB Debugging" on your device.
On the device, go to Settings > Applications > Development and enable USB debugging (on an Android 4.0 device, the setting is located in Settings > Developer options).
Set up your system to detect your device.
If you're developing on Windows, you need to install a USB driver for adb. For an installation guide and links to OEM drivers, see the OEM USB Drivers document.
If you're developing on Mac OS X, it just works. Skip this step.
If you're developing on Ubuntu Linux, there is a detailed guide in the link above.
Now in eclipse, your device should be available to run on.
In the eclipse toolkit, you have the option to run it directly on a device. It's rather quick to do so.
Enable USB debugging as well as installation of apk from sources other than the market. Then assuming you have already setup the required drivers/settings to connect to your phone via ADB, you should be able to run it on the device and debug. In the run dialog, it will list all available devices and you can simply select the one you want to use.
If you already have a run entry (i.e. you've already run your application),
select your project
click Run -> Run Configuration
You should be in your application run configuration (on the left under Android Application -> Your_App).
In the Target tab, you should be able to select your device. It will likely already be in "Automatically pick compatible device...". On my setup, it will run directly on my phone if it's the only available device. You can select Always prompt to pick device which will let you choose every time.
Eclipse plugin (ADT) information: http://developer.android.com/tools/help/adt.html
Information about setting up your device: http://developer.android.com/tools/device.html
I know android emulator is too slow.
You can either use device or
try bluestacks it saves lots of time.
User device only when you want to test your app for particular device.
Here is what you are looking for :
http://developer.android.com/tools/device.html
To summarize:
Plug your phone to your computer with a USB cable.
Make sure the drivers are installed and your phone properly connected.
Make a Ctrl + F11 from eclipse.
It will build the apk, transfer it to your phone and then launch it automatically.
If you have unit tests, Robolectric lets you run them without using the emulator or the device.
you can download bluestacks as emulator, as it is really fast.
after then make settings in eclipse as window->preferences->android->build -> then uncheck the 3rd checkbox written as "skip packaging and...", then apply and restart the eclipse to take effect.
now open the bluestacks in background and just double click the apk file in bin folder of eclipse and bluestack will install it in 2 to 3 secs and you can directly see the result.
NOTE here that you have to only save the file ,you working on in eclipse and only double click on apk, and result will directly appears to bluestacks. Without uninstalling and reinstalling apk in bluestacks.
and you can delete your apk also, it automatically immediately create
a fresh version of apk (thus not required) as soon as you save all your files apk will be updated.
Google BlueStacks.
It runs on Windows and it's really fast.

Categories

Resources