How to Use the run tool in Tool windows - android

My run tool of Tool windows in view is grayed out and I have no idea as to what to do to be able to use it

The Run Command is disabled when the Gradle is not built correctly.
Try Invalidating the cache.
Go to File > Invalidate Caches/Restart > Invalidate and Restart
Also, please attach the screenshot for Event Log, if above steps doesn't work for you.

The Run tool window displays output generated by your application. If you are running multiple applications, each one is displayed in a tab named after the run/debug configuration applied.
It highlight when any application in your IDE is in running state.

Got the answer. Very noob of me to ask. I should have tried a little harder. opened the gradle and pressed ctrl+shift. it worked

Related

the code completion disappear when typing in android studio

Sorry for Its the duplicate article, so its problem about my code completion when typing code or single words but the code suggestion not appearing and when i complete all then it just came out, or have just press Window+Space then it appearing which without that its still hidden. I look up for a lot of question about this error but none of there are worked.I also get in the Code Completion and trying to see but its still being like that.Anyway thank you so much for helping me this problem, i very admire and respect for that too
This issue with code completion can be caused by various reasons, such as a malfunctioning IDE, incorrect settings, or a damaged installation. Here are some steps you can try to resolve the issue:
Restart Android Studio: Sometimes, simply restarting the IDE can
resolve the issue.
Check the settings: Make sure that the code completion is enabled in
your IDE settings. You can do this by going to File > Settings >
Editor > General > Code Completion, and then checking if the
Auto pop-up code completion option is selected.
Invalidate caches and restart: Sometimes, the issue can be caused by
corrupted caches. You can try invalidating the caches by going to
File > Invalidate Caches / Restart.
Reinstall Android Studio: If the above steps do not resolve the
issue, you may need to reinstall Android Studio. Before you do this,
make sure to back up your important projects and settings.
I hope one of these steps resolves the issue for you.

Android Studio is not detecting code changes on build/run(

Whenever I make a code change in the Android Studio (version 3.0.1) I need to clean before I build in order for that change to take effect. Making a change and hitting the green arrow build/run button looks like it builds but the new changes are not incorporated unless the project is cleaned beforehand. For example, if I add some logging then build/run, the new logs don't appear until I clean then build/run again. This seems to be the case for almost all changes. Sometimes it works, most of the time it doesn't.
The compiler should detect changes to the code and rebuild those files every single time. It feels like they prioritized build speed over correctness. Has anyone else solved this problem? If not then is there some setting that forces a clean before every build/run?
I had the same issue after updating Android Studio to version 3.1. It seems that the Before launch action of the default run configuration has been changed to Instant App Provision. Check it out and change to Gradle-aware Make here:
I experienced that when I left my Android Studio opened for a long time. The solutions I found were:
Hit the "Sync Project with Gradle files" button.
Restart Android Studio.
I hope this helps you.
This suddenly started:
Code changes were not being reflected on the app / were not taking effect.
My "Run / Debug configurations" settings were as said by #4emodan.
Still, i was facing the problem.
"File -> Invalidate Caches / Restart ..."<br>
made it.
This could have been the result of my machine intermittently rebooting (because of hardware issues).
I found that I had to force the apk to install on every build - or risk that some of my changes will not be present. It seems that Google has broken something with the instant run in AS 4.1.2 -- to fix it uncheck "Skip installation if APK has not changed" in the "Run app" dialog.
I am using android Studio for about 2 months, this never had happened to me. For me I did a clear and rebuild project.

Failed to install the Android studio application on my phone [duplicate]

Trying to install app on real device following instructions:- http://developer.android.com/tools/device.html. At end Android Studio giving error:
Session 'app': Error Installing APK
I guess the problem probably can be in my android device(it is chinese Doogee X5). It does not have a given USB Vendor ID in developer docs so I decided to follow instructions with random vendor ID from HTC.
I'm sure there is a way to run application on any android device, but yet I didn't find an answer on how to do that.
I'm running through Linux Ubuntu 14.04 LTS
Edit:
In newer Android Studio versions you can re-sync the project using this button:
For older versions:
Open Gradle window (on the right side in Android Studio) and click on the refresh button.
However it is not a 100% sure fix.
Solutions for other cases:
Open terminal window and type "adb kill-server", then type "adb start-server". Usually after a few hours of inactivity, adb used to disconnect the device. (If you don't have the sdk/platform-tools in the PATH environment variable, then you should open a terminal in that folder)
One tip if these solutions don't help you:
If you open the Event Log window in the right bottom corner of Android Studio, you can see a detailed error message.
Other edge case
If you see this error: INSTALL_FAILED_INVALID_APK:... signatures are inconsistent.
Then unfortunately a gradle refresh isn't enough, you have to go to Build -> Clean Project and then Run again.
Issue with Android emulator
If you want to deploy the APK to an Android Emulator and you see the "Error installing APK" message, your emulator may be frozen and need restart.
Turning off the Instant run removed my error for Androdi Studio 2017.03.03 v2.3
You have to enable Developer options and enable USB Debugging:
Go to the settings menu, and scroll down to "About phone." Tap it.
Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. (If only it were that simple, eh?) Keep on tapping, and poof, you've got the developer settings back.
http://www.androidcentral.com/how-enable-developer-settings-android-42
Inside Developer Options, enable USB Debugging
Try using a different version of Gradle(stable version).
To summarize:
Check your gradle file for debuggable false/true
Invalidate caches & restart
Check your install location
Restart adb
I fix this by delete the build folder then run project again
Make sure that your device is not out of Memory!
I changed my USB port and that fixed it for me.
Make sure that project name doesn't contain special character.
Another possibility may be the USB driver on your PC. In my case, switching from my 3.0 USB port to my 2.0 port fixed the problem.
Ensure you android device has enough memory to install the app. Sometimes it so happens working with multimedia app where the device storage keeps on increasing and you keep wondering about the error.
Therefore, free up some memory and try installing again!
A bit late to the party, but be sure that you are trying to build a proper build variant. It sometimes happens to me that when I update AS, the build variants are totally messed up, so instead of building the "debug" variant I am actually building the "release" variant, which outputs apk to a different location (not to app/build directory, but to app directly) and I get the following error:
The APK file /path/to/file/app.apk does not exist on disk.
Error while Installing APK
To fix this just open the menu in left bottom corner, click on "Build Variants" and select the debug variant (it might have a different name, depending on how many modules/flavors or custom gradle build types you have).
Try to remove the .idea folder and .gradle folder, then click Sync Project with Gradle Files, when the process finished, try to run app again.
Hope it works.
just press Build button from menu bar and then press build app wait for it finished then press build APK and then run your emulator, it will work
Usage of easily changing variable value will often happen in build.gradle(like the Date)
In my case with Android 8.0(Oreo), no one of this solutions worked!
If you have more than 1 user, then you should go to Settings->Applications->All Applications->Find the application and uninstall for all users!
After this steps, it worked!
Just rebuild and clean project, then run project.
This happens because the gradle is not synced with the app. Go to : Tools -> Android -> Sync Project with Gradle files. Re-run and you should be good to go.
Nothing above helped me. The fingerprint dialog did not appear. I checked another android device and the dialog appeared and debug was possible.
So the problem was on device side not on computer side I made reset "to factory settings" on device and this helped me.
I fixed my issue, simply by using :
Build->Clean Project
then
Build->Rebuild Project
I had this same issue and none of the other solutions worked for me.
Although no errors were shown nor expanded upon in my IDE GUI, I opened up a second Android Studio window window with a different project and noticed in the bottom that the "Event Log" showed an error in a different window, but not in the project I had opened. The issue stated was:
Error: INSTALL_FAILED_CONFLICTING_PROVIDER
Which lead me here - Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER :
I had this FileProvider labeled in the manifest:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="myapp.sameonehere.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
Which I had copied from another project and forgotten to rename the 'authorities' String in. After changing it to something unique, it ran without issue.
Make sure you don't have any conflicting authority Strings like in my example.
Also, if no errors are showing up, try opening a second project and see if the "Event Log" shows errors in that location instead.
Uninstall the app, and re-install and it should work!
Go to avd manager and click on Wipe Data of the device you want to run. Worked for me. The size of device on disk will reduce after wiping the data. I hope it helps someone.
You have to enable Developer options and enable USB Debugging:
1:Go to the settings menu, and scroll down to "About phone." Tap it.
2:Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times.
After the third tap, you'll see a playful dialog that says you're four taps away from being a developer.
Keep on tapping, and poof, you've got the developer settings back.
My issue was solved by
Clean --> ReBuild --> Run
and in my case it was because i accidentally deleted the project folder and when i clicked ctrl+z to restore something wrong happened.
My problem was that I didn't accept the connection from the computer after turning on remote debugging. Once I accept the mac address, it went away. Silly mistake, but I didn't see the dialog box the first time. Worth a quick check if the others don't resolve the issue. But likely only a problem the first time you set up a phone.
What worked for me is deleting the app from the emulator (which was an app built from an older commit) and re-running from Android Studio.
It was written above: in my case it was just out of memory on device storage. Add more empty space - and error will disappear
I tried invalidating cache, deleting build folder and gradle sync. Also, I couldn't uninstall because the app is not visible on device. So I tried uninstalling through ADB and it worked.
adb uninstall <package_name>
If you are using android emulator, try changing a device.

Session 'app': Error Installing APK

Trying to install app on real device following instructions:- http://developer.android.com/tools/device.html. At end Android Studio giving error:
Session 'app': Error Installing APK
I guess the problem probably can be in my android device(it is chinese Doogee X5). It does not have a given USB Vendor ID in developer docs so I decided to follow instructions with random vendor ID from HTC.
I'm sure there is a way to run application on any android device, but yet I didn't find an answer on how to do that.
I'm running through Linux Ubuntu 14.04 LTS
Edit:
In newer Android Studio versions you can re-sync the project using this button:
For older versions:
Open Gradle window (on the right side in Android Studio) and click on the refresh button.
However it is not a 100% sure fix.
Solutions for other cases:
Open terminal window and type "adb kill-server", then type "adb start-server". Usually after a few hours of inactivity, adb used to disconnect the device. (If you don't have the sdk/platform-tools in the PATH environment variable, then you should open a terminal in that folder)
One tip if these solutions don't help you:
If you open the Event Log window in the right bottom corner of Android Studio, you can see a detailed error message.
Other edge case
If you see this error: INSTALL_FAILED_INVALID_APK:... signatures are inconsistent.
Then unfortunately a gradle refresh isn't enough, you have to go to Build -> Clean Project and then Run again.
Issue with Android emulator
If you want to deploy the APK to an Android Emulator and you see the "Error installing APK" message, your emulator may be frozen and need restart.
Turning off the Instant run removed my error for Androdi Studio 2017.03.03 v2.3
You have to enable Developer options and enable USB Debugging:
Go to the settings menu, and scroll down to "About phone." Tap it.
Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. (If only it were that simple, eh?) Keep on tapping, and poof, you've got the developer settings back.
http://www.androidcentral.com/how-enable-developer-settings-android-42
Inside Developer Options, enable USB Debugging
Try using a different version of Gradle(stable version).
To summarize:
Check your gradle file for debuggable false/true
Invalidate caches & restart
Check your install location
Restart adb
I fix this by delete the build folder then run project again
Make sure that your device is not out of Memory!
I changed my USB port and that fixed it for me.
Make sure that project name doesn't contain special character.
Another possibility may be the USB driver on your PC. In my case, switching from my 3.0 USB port to my 2.0 port fixed the problem.
Ensure you android device has enough memory to install the app. Sometimes it so happens working with multimedia app where the device storage keeps on increasing and you keep wondering about the error.
Therefore, free up some memory and try installing again!
A bit late to the party, but be sure that you are trying to build a proper build variant. It sometimes happens to me that when I update AS, the build variants are totally messed up, so instead of building the "debug" variant I am actually building the "release" variant, which outputs apk to a different location (not to app/build directory, but to app directly) and I get the following error:
The APK file /path/to/file/app.apk does not exist on disk.
Error while Installing APK
To fix this just open the menu in left bottom corner, click on "Build Variants" and select the debug variant (it might have a different name, depending on how many modules/flavors or custom gradle build types you have).
Try to remove the .idea folder and .gradle folder, then click Sync Project with Gradle Files, when the process finished, try to run app again.
Hope it works.
just press Build button from menu bar and then press build app wait for it finished then press build APK and then run your emulator, it will work
Usage of easily changing variable value will often happen in build.gradle(like the Date)
In my case with Android 8.0(Oreo), no one of this solutions worked!
If you have more than 1 user, then you should go to Settings->Applications->All Applications->Find the application and uninstall for all users!
After this steps, it worked!
Just rebuild and clean project, then run project.
This happens because the gradle is not synced with the app. Go to : Tools -> Android -> Sync Project with Gradle files. Re-run and you should be good to go.
Nothing above helped me. The fingerprint dialog did not appear. I checked another android device and the dialog appeared and debug was possible.
So the problem was on device side not on computer side I made reset "to factory settings" on device and this helped me.
I fixed my issue, simply by using :
Build->Clean Project
then
Build->Rebuild Project
I had this same issue and none of the other solutions worked for me.
Although no errors were shown nor expanded upon in my IDE GUI, I opened up a second Android Studio window window with a different project and noticed in the bottom that the "Event Log" showed an error in a different window, but not in the project I had opened. The issue stated was:
Error: INSTALL_FAILED_CONFLICTING_PROVIDER
Which lead me here - Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER :
I had this FileProvider labeled in the manifest:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="myapp.sameonehere.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
Which I had copied from another project and forgotten to rename the 'authorities' String in. After changing it to something unique, it ran without issue.
Make sure you don't have any conflicting authority Strings like in my example.
Also, if no errors are showing up, try opening a second project and see if the "Event Log" shows errors in that location instead.
Uninstall the app, and re-install and it should work!
Go to avd manager and click on Wipe Data of the device you want to run. Worked for me. The size of device on disk will reduce after wiping the data. I hope it helps someone.
You have to enable Developer options and enable USB Debugging:
1:Go to the settings menu, and scroll down to "About phone." Tap it.
2:Scroll down to the bottom again, where you see "Build number." (Your build number may vary from ours here.)
Tap it seven (7) times.
After the third tap, you'll see a playful dialog that says you're four taps away from being a developer.
Keep on tapping, and poof, you've got the developer settings back.
My issue was solved by
Clean --> ReBuild --> Run
and in my case it was because i accidentally deleted the project folder and when i clicked ctrl+z to restore something wrong happened.
My problem was that I didn't accept the connection from the computer after turning on remote debugging. Once I accept the mac address, it went away. Silly mistake, but I didn't see the dialog box the first time. Worth a quick check if the others don't resolve the issue. But likely only a problem the first time you set up a phone.
What worked for me is deleting the app from the emulator (which was an app built from an older commit) and re-running from Android Studio.
It was written above: in my case it was just out of memory on device storage. Add more empty space - and error will disappear
I tried invalidating cache, deleting build folder and gradle sync. Also, I couldn't uninstall because the app is not visible on device. So I tried uninstalling through ADB and it worked.
adb uninstall <package_name>
If you are using android emulator, try changing a device.

Unable to clean or rebuild project in Android Studio 2

I have a problem with my Android studio 2. That's whenever I want to clean or rebuild my android project, I always get this message
Error:Execution failed for task ':app:clean'.
Unable to delete directory: C:\Users\MyPC\Desktop\SharePlace\app\build\intermediates
and can not fix it. what I only can do is go to File explorer and delete it.
then come back android studio and rebuild again. Sometime, that way also does not work.
I need some help to fix that Android studio. Please.
Thank inadvance!
Solution 1 :
you are using Android Studio 2.0 Beta, this issue might appear (more likely if you are working on NTFS filesystem) and it seems like the "Instant Run" is the culprit. Search for "Instant Run" in settings and uncheck the box.
I have filed an issue on the bug tracker.
Solution 2 :
You need to go to the source file directly. Close the studio and go to the path the issue is located at and delete the folder there.
I got a lot of faults like this.
Try to refresh all gradle projects: in Android Studio click on the "Gradle" tab on the right side of the window. When the gradle menu is shown, click on two blue mixed arrows icon. Then wait a moment until gradle completes refreshing and try cleaning or rebuilding again.
For me it was fixed by running Android Studio as administrator.
Manually deleted folder( build\generated and build\intermediates) after closing android studio works for me.
Found the solution. For windows, goto Task Manager and find your Android Studio. Expand it and end task for OpenJDK Platform Binary as depicted below
screenshot.
Then re-run your app in Android Studio again. It should work, and you don't have to restart your Android Studio all the time. More productivity~

Categories

Resources