Last night, I clicked "run" button and Android Studio built my app.
But after completing the build task, it did not work on my device anymore.
How to fix that? Do I have to set the auto run option?
I checked the application installation on my device.
My issue is that "autorun on device" does not work.
Open the Gradle tab that is on the right side of the Android Studio UI.
Find the installDebug option, and the Run button will use that as the "last ran" command.
If you are otherwise unable to run the app, then you may have a compilation issue
Related
I have a freshly installed android studio on my PC for flutter development, but I am facing this issue.
As seen in the photo the virtual device shows up.
https://drive.google.com/open?id=1mcGs0qxKVZafD4j0J02n44n-3fbu1iHR
but it shows loading in the android studio toolbar.
https://drive.google.com/open?id=1yJ18a7DL4Livfc31pKryXrRJCUjkO1hW
when I try to run the application this message shows up
https://drive.google.com/open?id=18cWfhtbh4M9Nkn8KQAaRRSvLi8R0DPMR
but when I run "flutter doctor" everything seems to be fine.
https://drive.google.com/open?id=1E6MoIvWEnwFjOl-E_gjYQAjxJSlvs6fz
though if try to run it using "flutter run" nothing happens it just gets stuck on "running gradle task"
https://drive.google.com/open?id=1f6D1V63c06uu6LyY077zP6DLkEkggnTN
for android device, I solved it using this :
flutter config --android-sdk /path/to/android/sdk
not sure if it'll work with iOS devices as well.
Please check your studio is loading current active device.
On top there are four option:
1) One is for on which active device you want to run apk(phone icon available).
2) Second is represent starting point of app(flutter logo icon).
3) Total device available.
4) last on run app
so please check first option where studio find active device.
Recently I have updated my android studio v3.0 to v3.1.
in v3.0 when I click on Run button. It automatically complies builds apk and installs app on my phone.
But at newer version I have ti rebuild app each time before running application. Otherwise it installs previous compiled APK on my phone. Is their a way to do both at on button click.
because its frustrating.
I have searched in settings but no option found.
I had the same problem. I fixed the problem provisionally, adding the task 'app: clean' in the Run / Debug Configuratrions before the app is "made". It takes much longer to compile and build the app than before, but it will always install the latest version, at least for me.
Open the Run / Debug Configurations. Can be found to the left of the Run Button.
Run / Debug Configurations
In the configurations you will find at the bottom the section "Before launch". There, you are leaving out "Run Gradle Task".
Adding Run Gradle Task
Under Project you choose your current project and at Task you choose clean.
Select settings
Importantly, the Gradle Task is at the top of the list!
mind the order
Run project
Hope I could help you with that
I'm building an app in Android Studio. After some time the app stopped reflecting the progress of the building development. I then uninstalled the app from the emulator and it has not installed although build is successful every time. I built the apk for the app and dragged it to the emulator. App is installed but does not start. Is there anything to make it work?
Have done the following:
enabled and disabled Instant Run
enabled and disabled ADB integration
restarted Android Studio added debug{debuggable true} to buildTypes in the app gradle even though it is not advisable
Device Monitor says "ADB rejected shell command (ls -l /)" and "Adb connection Error:EOF"
Thank you
PS:
Android Studio version 3.0.1
Check "minSdkVersion" in App Gradle. if it is less than the Emulator which you have then it will not install or run on it. Make sure "minSdkVersion" should be greater than or equal to Emulator API level.
In Android studio Go to "Build Variant" tab and then change your application build Varian to Debug.
Finally solved it. Thanks to Andy Boot's answer to this question. In short:
I went to Run->Edit Configurations->Android App->app
The Launch droplist had 'Default Activity' selected. I changed that to 'Specified Activity'
I then filled in 'MainActivity' in the Activity field, which has the 'LAUNCHER' intent in the Manifest file.
And that got my app running once again on the emulator ;)
Thanks, everyone.
Do the following if you are facing like Gradle Build finished successfully while running app but app is not installed in Mobile or Android Emulator then follow the steps
In 3rd image 'Deploy' and 'Launch' options should be selected as shown in picture. Apply settings and click OK. YOU DONE.. HAPPY CODING.
At this point, Im using Android Studio 2.1.2. When I changed the code or without changed the code, the app is always kill and restart the session when I want to run the app.
Run App
So how to run the app without kill and restart the session?
You are wondering about Instant Run facility added in most latest versions of android studio. To use it please Make sure you have up to date Gradle plug-ins and builds because it's not only enough that having latest version of Android studio will support Instant Run it also required all stuff up-to-date so Please first check it out.
To check it out if it is disable follow this steps
1) Go to File -> Settings
2) Go to Build,Execution,Deployment -> Instant Run
By default It is enabled if everything is up to date. If not you can.
Go read this for depth understanding : https://medium.com/google-developers/instant-run-how-does-it-work-294a1633367f#.mqwx46kn6
And what is supported under instant run is given here.
https://stackoverflow.com/a/33905037/5476209
You need the latest Gradle build in your project for the same And also you need to run the same app in your phone so that the patch will be installed and activity will be restarted.
Please not that every time you hit an error in run time the quick launch will get disabled and you will have to rebuild the whole project to Instant run again.
Reference :http://tools.android.com/tech-docs/instant-run
Exactly my problem, if I have small change in app about display UI (modify activity code or resource layout), Android studio build very fast and then run my app in emulator without kill "previous version" process (running in emulator), sometime it's run and display correct, but sometime it doesn't run correct what I want, I must kill process manual and rebuild project, it takes a lot of time, and makes me confused because I don't know where go wrong,
I thought this is my bug.
It happen recently when I update Android studio, I think this feature is very powerful and helpful, application mustn't rerun from the beginning whenever build new version.
But how to enabled/disabled "fast build", sometime I want Android studio build my project normally.
You have 2 solution:
1)You can also disable Instant Run from Settings > Build,Execution,Deployment > Instant Run - and disable it
2)Clean Project when studio doesn't build properly
Press the stop button before running the app and then run the app so dialog will be displayed to choose the emulator.