Android: Fast way to "test" app - android

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.

Related

Another way to debug an android app

I want to debug my android application, I have Eclipse Installed fully setup for android developement.
The problem is,
1) I can't run android emulator(Hardware Concerns).
2) I can't attach phone to my computer(Driver Concerns).
Now,
Is there a way to get debug functionality by putting directly the apk into the phone storage and installing it from there.
I wanted get the logcat of the application that I'll be running.
Basically I'm quite naive in android, I'm not quite sure of the terms I said but, What I want is a way to test my app on my phone without the role of my PC.
If you have root you can use Wifi ADB
Also you can remove drivers for this device and install other driver from your device manufacturer.
If you can run standard emulator you can use Genymotion.

Android Emulator won't work

When I run the android emulator it gets stuck on the android animation. After I have waited 1 hour it said "Proccess system is not responding". I've tried to delete it and create a new one but it didn't work. I want to start android developing but I'm about to give up because nothing works. Please help.
Thanks in advance.
Try re-installing the avd. or better still you can use an android device an Emulator, which is better and faster. to use an android device follow this steps.
1. Get an android device and a usb cable.
2. Go to settings on your android device and select developer options.
If your device does not have the developer options, goto about phone and click on Build number 7 times., go back to settings (Developer options would have appered by then)
select developer options, turn it on and enable debugging.
3. plug your device into your system.
4. your phone will notify you on access to degug.. Accept.
5. Close any avd you might have opened before..
6. Run your app..
You are good too go...The app should run on your android device..
BUILD NICE APPPPPPPPPSSSSSSSS

Android test application directly on device

is there a way to compile an apk and test it directly in an usb-attached device ? The emulator is way too slow for a fluid development.
Using eclipse, make sure the project is debuggable, software for the phone is installed on the computer. Set the phone to accept unknown recourses. First connect the phone, then start eclipse (sometimes the other way round results in the phone not being found) If you try to run the application eclipse should prompt you asking witch device to use. Click your phone and presto!

Android: Debugging Android Applications on a Handset

I am trying debug android aplication on real phone (HTC Desire).
I enabled USB debugging on my Android Device.
Then i clicked on debug configuration,set Deployment Target Selection Mode to Manual and i clicked on debug but in Android Device Choiser i can't see my phone.
What can i do please?
I assume you are using eclipse as your IDE. I have to say that I use IDEA, So my experience with debugging could be different.
These are the steps that I have to do:
1- Enable USB Debugging. ( You have already enabled it).
2- Download HTC Sync software for my Computer (MacBook).
3- Close already open emulator and connect the device to my computer.
4- Start debugging session.
I did not get a device chooser dialog also. But to my surprise the phone was chosen over the emulator.I do not know how much you can get from my personal experience, but its worth a try.
You need to install drivers for the phone on the host machine. You can probably get the driver from HTC.
You may have to install the drivers for that device on your PC for the debugger to be able to see it. Also set the option in Android to allow install of non market applications. I almost forgot that your project also needs android:debuggable="true". See the link:
http://developer.android.com/guide/developing/device.html
That varies depending your operative system.
On Mac you should be set to go.
On windows you may have to download USB drivers.
On Linux you may have to change a configuration file.
Read the how-to here: http://developer.android.com/guide/developing/device.html

How to test my app on my phone? I have Eclipse w/ Android plug-in

Where do I copy the apk file on the Motorola Droid? Which directory? Are there any possible issues I need to be careful of, it's also my personal phone...
To install an apk file, you need to execute
adb install /path/to/file.apk
While the droid is connected. I would avoid using any programs other an adb to install your application. adb will definitely follow the rules and you should be able to clean things up, etc if something goes wrong. That may not be the case with other programs.
I should note, this is assuming you are writing the program yourself. adb is a program that comes with the Android development kit (I assumed you are using this as this is a programming related site. If you are not referring to this and you are simply trying to install a program on your phone, this question would probably be better on superuser.com)
Edit To address your comment. When you select "run" from eclipse, and you have your droid plugged in, it should give you the option to select which device you want to execute the code on. Double clicking on your droid will automatically install and launch the app. You may need to enable the development settings within the Settings menu though for it to be recognized. To confirm that eclipse (really it's adb) can see your droid, launch a terminal or command prompt and type adb devices while the droid is connected. If it's listed there, you're good to go.
I guess I was making it way more complicated than it needed to be. If you have eclipse with the Android plug-in, all you need to do is go into the settings of the phone, then applications, then development. Set the Debug mode to on. when you compile the app with eclipse I guess it looks for an actual phone first, if it detects it, then it loads the app on it. If no phone is detected and you have the ADV set up right it loads it there. Easy... There is a setting about unsigned apps in the application menu, I set it to accept and turned it off after, my apps are still on the phone and work... I am not sure if it was needed at all.
I don't know whether this is how you're supposed to do it, but get Astro File Manager, and you can install your app wherever you place it.
There shouldn't be anything you need to be careful of if it isn't rooted. Programs are pretty well contained and can't do much outside of their own little Dalvik machine.

Categories

Resources