See app changes in real time on real device - android

I have Eclipse with Android Development Kit (ADT) installed, and also SDK. I have connected my Venue7 tabled and enabled USB Debugging.
I've created a simple Hello World app and ran it on my Venue7.
Now is it possible to update the app via Eclipse and see the result #Venue7 in real time? Or do you I have to stop the app and start it again after each change?

When you install your program on your device you are doing just that - installing it. The .apk file you have there is an installation package (apk stands for android package) not an executable file. So yes you have to reinstall it each time you have made changes to the program.
On eclipse I believe you just click the run as android program as the other poster said.

If you are using for the first time, Just see the left side, in package explorer, right click on your package- Select Run As Android application.
You dont need to stop an app. Just Run it from eclipse

If you have made changes in source code and you want to see the effects, you no need to stop the app/device or emulator. But you need to re-run the package again.
You can do this by 2 ways:
Right-click project, run as Android application
CTRL+F11 is to run the application. But for this you have to apply pre-settings as below.
Windows>Preferences>Run/debug > Launching : Launch Operation; "Always launch the previously launched application"

Related

How to install app on device without running it automatically using Android Studio

I need to install an app on a physical device from Android Studio without it starting automatically because I need to ensure the device is completely isolated from all outside networks, etc. when I launch the app on the phone.
I did some research but could only find the following two irrelevant posts:
Installing Android app on device from Android Studio - Irrelevant because it doesn't specifically ask how to install without automatically launching.
Install Android app in Eclipse without running it - Irrelevant because it asks about Eclipse instead of Android Studio.
I found the answer at https://developer.android.com/studio/run/rundebugconfig#general-tab .
Steps to install app on device without running it automatically using Android Studio:
Go to Run > Edit Configurations
Find the app you want on the left side, for example, a common one is under "Android App" and it's called "app"
On the General tab, find the Launch Options section and under Launch change from the default (which is "Default Activity") to "Nothing"
note: assumes Android Studio Arctic Fox | 2020.3.1 Patch 1
The option "Nothing" is defined as follows in the documentation link above:
Don’t launch anything when you select Run or Debug. However,
if your app is already running and you select Debug, Android
Studio attaches the debugger to your app process.

Debug.waitForDebugger(); not working in Android studio

When I worked with Eclipse, I used Debug.waitForDebugger() to enter debug mode in hard to reach classes like services.
However, since I moved to Android Studio, I was not able to get Debug.waitForDebugger() to work.
When I add it and run the app, it does not enter debug mode at all.
Does anyone know how to make Debug.waitForDebugger() work in Android Studio?
Quoting from AOSP issue 76040 https://code.google.com/p/android/issues/detail?id=76040 -
"DDMS in Eclipse will monitor apps run on a device. When apps show up in ddms in "waiting-for-debugger" mode and the app name (its package) match the package of an app opened in the workspace, then ADT will automatically connect the debugger configured with that particular app.
We should do this in Studio as well. Probably after 1.0 though"
Up until today this problem has not been resolve yet in Android Studio.
try android.os.Debug.waitForDebugger();
Use the emulator/device entries under "Settings>Development Options" as advised here

How do I uninstall and re-run an app on a device using Android Studio?

I am new to Android Studio and I feel that I must be doing something wrong. When running MyApp on an actual device the process goes like this.
Edit code.
Select the Run command in Android Studio. (Shift+F10)
Discover a Bug (on phone)
Navigate to Settings --> Application --> MyApp (on phone)
Force Stop (on phone)
Uninstall MyApp (on phone)
Edit code
Select the 'Run' command in Android Studio.
Repeat again and again.
This is repetitive and time consuming. Is there a way to uninstall MyApp via Android Studio?
If not is there some other more automated way to do this?
BTW I have seen this question How to automatically uninstall android app from device before installing a new version but it does not sufficiently address the issue.
I think this answer is what you're looking for. Basically edit your configuration to perform an uninstall before app launch.
From the Run menu -> Edit Configurations... -> Before Launch -> Add Gradle-aware Make -> ":app:uninstallAll"
You can execute the gradle task :app:uninstallAll to uninstall the app. The next time you hit Run your app will be reinstalled.
You can skip the force stop and uninstall step by just hitting run again. Android Studio should prompt you which device to run on and there you can select your connected device.
It will close the app and re-run your changed version.
I always just hit the "debug" icon (the bug icon) and from the debug tab (at the bottom of your screen), you can stop running the app by clicking on the stop button. No need to uninstall/reinstall app. When you're done, you can do a release build of the apk.
You can make just like this now. Check mark on Clear app storage before deployment.

Cordova app deployment on device

I'm using Eclipse to run my android mobile app. The problem is that when modify code the change not appear in the deployed app on device. Remain ever the same app on device.
If you are changing code in yourProject->www folder, then you need to build it first with command prompt /cli
OR you need to directly change the files in yourProject->platforms->...->www before running from Eclipse

running android emulator from worklight

I wish to run an application on android virtual device (I've created it). I right-click on the
Android project (which was created after I added the android environment) and choose "Run as Android Application". The emulator launches but it remains just a black window (and I wait a lot, nothing happens). Console writes "Build successful" and that's it. What might be the problem? API level is 18 (4.3). Platform Windows 7. Thanks.
Details: created a project, added hybrid application, added adaptors, deployed and run multiple times (just in browser), installed android in eclipse, added android environment, added AVD (had some old ones that didn't work, deleted them and created a new one following advises here).
It sounds like the problem is with your Android emulator.
First, can you start the emulator by itself, and see it work properly? You can start it from AVD itself. The emulator usually takes a long time to start, especially if you are running the ARM emulator instead of the x86 one.
If that works, can you run an empty Android app? You can go to File - New Project - Android Application Project, and after you create it, you should be able to run it and see an empty application.
If that works, can you try with an empty Worklight application? That way we can see if it is your specific application or something to do with Worklight.

Categories

Resources