Android Device monitor disabled - android

I'm just getting started with Android development and was setting up Android Studio on my mac. (Following the instructions here)
When trying to run a simple hello world application and trying to learn my way around the IDE, I noticed the "Android Device monitor" disabled. Any ideas how I can fix this? This should be important when debugging apps hence the question.
I'm not sure what other info might be important for this question. I did make a few changes in the SDK manager, but they were just installing more components on top of what was already installed.

Once you open a valid project, the buttons become enabled.
Note that, even if the option is disabled, you can still bring up the Device Monitor by running the monitor.bat file in the tools directory of the Android SDK. (On Windows you can just double click the file or run it from a cmd shell.)

This problem occurs to me today. And I just click the button on the pic.
Problem solved.
and If this didn't work ,you can check this list in your Android Studio
1.Tools->Android->Enable ADB Integration
2.If you open DDMS, CLOSE it .
If these didn't work too, check the official file.
https://developer.android.com/studio/profile/am-basics.html

Related

Android Studio - launch emulator AVD - "unable to locate adb"

When I launch emulator in Android Studio through AVD, it keeps on having this annoying popup "unable to locate avd".
I'ved removed platform tools and reinstall it under SDK Manager->SDK Tools->Android SDK platform-tools so that its a new avd.exe but it doesnt help.
I am really clueless now how, I would like adb prints coming from the emulator to debug. How can I solve this ?
FYI, I am developing flutter on Android Studio 4.0
I had the same issue as you were facing, I have Researched the Whole Internet but found nothing useful. So, I somehow figured out the problem and fixed it, The problem is at
app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
Whenever we create a new project due to some reason the Module SDK is not set up automatically. Thus the ADB manager was throwing an error 'Unable to locate AVD', which is not that fatal as the error/warning is not stopping us from launching /starting the emulator, but it is so annoying to see that pop-up box. So here is my simple and quick fix.
Solution:
Click on the project folder, tap the dropdown icon just beside it.
Now Navigate to the path below.
> android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
Now Click on the file GeneratedPluginRegistrant.java to open it.
Once it is open, At the Top you will notice a bar that says 'Module SDK is not defined',
Now right against it, you will also see a hyper-text named 'Setup SDK', Just Click on it.
That will open a Pop-up Box with the title 'Select project SDK'.
Now select the Android Platform API and then click OK. After that being done Restart your IDE.
Your Problem will be Solved. And you will also notice that Emulator Opens up way faster than before.
NOTE:
The Above Steps has to be performed with every new flutter project.
I have attached some screenshots just follow them.
The Problem
The Below image represents the annoying Popup-box that you encounter while launching the AVD which we are going to fix.
Step 1 : Close the AVD window
Step 2: Navigate to GeneratedPluginRegistrant.java
Step 3: Look for Module SDK not Defined
Step 4: Against to Module SDK click on Setup SDK hyper-text.
Step 5: Select any Android SDK version
Step 6: Click OK
Step 7: Restart Android Studio IDE.
After Restart you wont see the Annoying popup box anymore.
I have also Uploaded a Youtube Video for you. Check that out as well.
https://www.youtube.com/watch?v=19ESTnrmYJY&feature=youtu.be
This may seem very basic but start with a full system restart,
Where did you install the SDK's & AVD(Default Directories).
Do you have the same issue when you plug in your own Physical Device.
Ensure you have enabled USB Debugging for step 2.
If possible walk us through the installation steps so we can identify any possible errors you may have made
I've had the same issue and it took a while to figure out what's wrong, but in the end, it was a storage problem, just check if you have couple of gigs (at least 5gb) of free space left where you have your avd installed. That fixed it for me.
Try this.
Copy platform-tools address and paste it in environment variable in path.
C:\Users\viram\AppData\Local\Android\Sdk\platform-tools
hope this works.
I will answer this myself as this was how it was solved.
open a native android project, and then adb works.
This looks like a bug in flutter.

Visual Studio 2015 Xamarin deploy fail without any error message

I just installed VS 2015, the installation was finish (after some fail time caused by the slow network, I run setup again).
I create a project as Android > Android blank project
When I press F5, the build is seem to by success but the deploy is fail, there isn't error message. Tried set Tool->Option->Build->Diagnostic, no result. VS 2015 is pretty new, is anyone met this? How can I fix this?
I bumped into the same, but I started VS2015 as Administrator and solved the problem.
Is any Android Virtual Device running?
Open AVD menu
Launch the device
Wait for it to fully load
Build and deploy
Find your app in device's menu and execute it
Visual Studio gets stuck trying to deploy the app to the emulator or the emulator does not appear as a debug target in other IDEs
If the emulator is running, but it does not appear to be connected to ADB (Android Debug Bridge) or it does not appear in Android tools that make use of ADB (for example, Android Studio or Eclipse), you may need to adjust where the emulator looks for ADB.
The emulator uses a registry key to identify the base location of your Android SDK, and looks for the \platform-tools\adb.exe file under that directory. To modify the Android SDK path used by the emulator:
Open Registry Editor by selecting Run from the Start buttons context menu, typing regedit in the dialog box, and choosing OK.
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools in the folder tree on the left.
Modify the Path registry variable to match the path to your Android SDK.
Restart the emulator and you should now be able to see the emulator connected to ADB and associated Android tools.
And yet another recipe of fixing this:
clean projects
remove all bin, obj folders
mark your android-project
as startup
then try to deploy again
As for me, in some cases, if visual studio stucked on project building, it requires pc reboot.
I had the same annoying issue. Going to Options -> Xamarin -> Android Setting and checking Preserve application data/cache on device between deploys solved my problem.
I was facing same issue.
Just reopen visual studio and rebuild your project..and then try to deploy.
Its worked for me!
According to Magnus Grindal Bakken's comment, I found the solution.
1) The installation must have an internet connection to be completed.
Any interruption may cause components to be excluded.
2) You need android emulator. Installing the Android SDK and Visual Studio 2015, is not sufficient, You either need the Microsoft emulator, the android one or another third party emulator (like Genymotion). You also need to ensure that the Xamarin plugins for Visual Studio are installed.
Xamarin for Visual Studio can be downloaded here. Once it is installed Visual Studio will be able to create and run Xamarin projects. Xamarin for VS includes the Xamarin Player for emulation. I think it's even better than Genymotion.
Start emulator via AVD manger ... [start] button (as user m93a suggested).
And next option contains check option "wipe user data". Check it !
It helps me solve this problem. Then deploy or debug the application and all process will works as expected.
I had the same problem with my XF App, it didn't deploy and just one message saying Deployment Failed, internal error....
I solved it. Working on Mac with Xamarin Studio, make sure that the ABI of your simulator is supported by your app.
Xamarin Studio Android project Options
Just run your Visual studio as Administrator mode.
Sometimes the physical Android device gets confused about versions.
On the device, to go settings | Applications Manager | All applications.
Manually delete your application.
Manually delete "Mono Shared Runtime" (don't worry it will reinstall during deploy)
Make any change in your project so it is seen as altered and needing to be recompiled: Add a new blank-line to a .cs file or something.
Build
Debug/deploy
I faced that problem couple hours ago, I tried to deactivate hyper-V and it worked for me.
In the Android App project Properties in Visual Studio I had to go to Android Options>Advanced and make sure the Support architectures had the architecture of my AVD checked.
In my case this was x86_64 (which, by the way, does not have a particularly discovereable method of installation - took me days).
First of all, we can find the error in "Details" when we click "Start" button on "AVD Manager" for "Android_Accelerated_x86". If the error is as follows :
Please ensure Intel HAXM is properly installed and usable. CPU
acceleration status: HAXM is not installed on this machine
So, in this case we need to install "Intel® Hardware Accelerated Execution Manager". It can be downloaded from following link :
haxm-windows_v6_0_6.zip (6.0.6)
Note: After installing Xamarin for the first time in visual studio 2015 i had the same error to run "Android_Accelerated_x86". After installing this accelerated emulator is now up and running.
If the emulator does not even lauch, maybe deploy is skipped.
You cas see this in the output console.
If so, you may have to activate the deploy by checking it in the solution's (not project) parameters.
If the emulator launches but the deploy won't end after minutes, with no error, try the steps described here : https://stackoverflow.com/a/32564067/7505268
That solved it for me.
I had Xamarin Android Player opened while trying to deploy the Android project. This steps worked for me:
Closed Xamarin Android Player
Ran Android project again
in my case I had this problem because "Solution Configuration" was set to Release. I change it back to Debug and I solve the problem
Try one of the following and see if you can get the app to deploy to your device.
Clean and build project/solution
Make sure you have updated all the NuGet packages (Right click on solution and click on Manage NuGet Packages.... Then check in Updates section whether there are any updates)
Make sure you have installed all the necessary SDKs from the Android SDK Manager
Check whether you have selected the correct project as the startup
Check if you have set the correct path for Android SDK and NDK locations
Make sure you have checked Deploy for your selected project from Build -> Configuration Manager
Well there can be many reasons,one of them could be that from the Build section in your toolbar,if you check the configuration manager there will be project names that are available in your current solution all you have to check is if the deploy checkbox is checked or not.If not kindly check it and things will work just fine
This worked for me:
Making sure that Define DEBUG constant is checked.
Using Log.Info("yourTag-AnyString", "Error before/after ");
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
Log.Info(tag, "Error before Layout");
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
//Button button = FindViewById<Button>(Resource.Id.MyButton);
//button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
Log.Info(tag, "Error before variables");
userName = FindViewById<EditText>(Resource.Id.editTextUsername);
password = FindViewById<EditText>(Resource.Id.editTextPassword);
btnInsert = FindViewById<Button>(Resource.Id.btnInsert);
Log.Info(tag, "Error after variables");
btnInsert.Click += BtnInsert_Click;
}
changing emulators or exporting the signed .apk instead
For android apps, using android device logging
There is actually a connection between running Visual Studio as administrator and setting the registry path.
I followed the instructions here but it only worked after running VS as admin because my Android SDK path is in "C:\Program Files (x86)". So in order to add or change files there you need admin rights. Alternatively you can change the permissions of the "Android" folder so that the group "Users" as full access. This worked for me as well.
Or you make sure you don't even install the Android SDK in "C:\Program Files (x86)".
By the way I found that restarting VS, or even the Emulator again wasn't necessary after I added the registry key. It picks it up when it needs to.

Android Studio and android device monitor

I just switched from Eclipse to Android Studio. For what I saw since now the new IDE has a lot more features than Eclipse, and I like using the new IDE for my app development work.
I just can't understand one thing: in Eclipse, there is the very useful DDMS perspective, from where you read Logcat and do a lot of other things, like using the very useful dump view hierarchy function, which allows you to take a dump of the UI and inspect it to understand what is shown where in your layout.
I'm not seeing nothing similar in Android Studio, and after making a lot of research it seem that the only way you have to do this is opening the Android device monitor from the "Tools" menu.
But doing this way the ADB connection get broken, because it is being used by Android Studio, and Android Device Monitor wants to use it. The result is that if you are debugging your app you can't open android device monitor unless you want to lose your debug status.
I think this is not acceptable and I'm sure there must be some better way to use Android Device Monitor tools together with Android, is that possible?
Thank you
Actually I found a solution, I don't know if it is the best way (I keep thinking that android studio MUST integrate device monitor in a better way )
As stated in the question, starting device monitor from the menu tools causes android studio disconnect the device, but if you open the android studio's built in terminal (View > Tool Windows > terminal) and just type "monitor" it starts device monitor without detaching the device from android studio (you will get a warning on device monitor saying that there was a problem attaching the debugger, but don't care about that)
hope this will help some one
There are several ways you can find the DDMS tool using android studio. Eclipse is not needed for that as the tool is a separate program that comes with the android SDK.
Click on the Android Device Monitor Icon in the toolbar in Android Studio
Open the monitor.bat file (on a windows machine, this is located in [path-to-sdk]/sdk/tools)
Type monitor in the terminal in Android Studio or in any command prompt. (thanks SimonVeloper)
Open it via the tools menu. Tools->Android->Android Device Monitor (thanks sebweisgerber)
This will open the DDMS tool and will automatically connect to connected devices.
Normally you will be able to view your logcat output through this tool and not in android studio anymore. If this doesn't work for you make sure your devices is properly connected and restart the tool.
To open the Android device monitor simultaneously with Adb, Run the montior through the command prompt instead of visting to the Tools->Android->Android device monitor
To run via the Command line interface navigate to the :
Android/Sdk/tools/ and then run the monitor (for linux run -> sudo ./monitor)
Android studio ,Android device monitor opens but you cannot display Logcat or device another functionality,Just go to your android studio tools option tick Enable ADB integration then you can open other ADM screen.This worked for me.
I faced problem in android device monitor . I could not find file explorer menu , device list in android device monitor so i
deleted hidden *.android* folder in the home directory in linux using the following command:
`$ sudo -r ./android`
After deleting this hidden folder your android device monitor will be set to default state.

android studio - emulator doesn't work and genymotion doesn't get recognized

I'm building an app in Android Studio (beta) 0.8.9, though I can't seem to get emulators running. I've made a Nexus 4 and 5 emulator through the options, but I can't seem to get them started. It shows this in the Run App tab.
Waiting for device.
"C:\Program Files (x86)\Android\android-studio\sdk\tools\emulator.exe" -avd smallEmulator -netspeed full -netdelay none
So either it's not starting up, or I'm just an impatient SOB.
I've also downloaded Genymotion and started up an emulator through that, but now Android Studio doesn't recognize the emulator anymore. I try to run my app and check for any running devices, but it doesn't show up, despite the fact that it actually is running.
I've added the Genymotion plug-in, to no avail. No idea what went wrong.
I also have a One Plus One, which I'm not sure how I can debug on that. They don't seem to have drivers for that and haven't immediatly found anything on Google so far.
Any help would be much appreciated.
EDIT: I fixed my problem. I used Genymotion to fix the problem. The running emulator wasn't turning up, because the android SDK's weren't linked to one another. Genymotion and Android Studio used different ones. So I edited Genymotion's settings to use the same one of AS and now it works!
First of all, update android studio. Check if the emulators run from the AVD manager outside Android Studio, I mean by starting it up manually from ur SDK installation folder (AVD Manager.exe) . Check the path of ur emulator in .ini file in C:>Users>user-name >.android>avd. U can make a system variable for ur SDK folder "ANDROID_SDK_HOME" and place the .android folder's content there (the whole .android folder). Sometimes "resetting the adb" after u run emulator may work.
There may be an easier fix than what was previously mentioned. Try opening Android Studio, go to File, Settings, plugins. Select the “Browse Repositories” button at the bottom of the page. Scroll down the displayed page to find “Genymotion”; select it and install it.
When it has installed, restart Android Studio. Again, go to File, Settings, then go to Other Settings. Genymotion should show up as an option. There will be a field that asks for the path to the Genymotion folder.
Mine was: C:\Program Files\Genymobile\Genymotion. At any rate, enter the path, click Apply or OK and Android Studio should recognize Genymotion (You may need to restart AS once again). Now you should have a small red icon on Android Studios tool bar; when you hover over it a pop up that identifies it as “Genymotion Device Manager”. Click on it, select a device to load, click start and allow the virtual device to start completely. Now run your Android Studio project; the Android Studio “Device Chooser” will pop up. You should see the Genymotion device you’d started previously, select it and you’re good.
Hope this helps…

android apps not deployed to phone

i just started android development and have the problem that my apps are not deployed to the phone - neither my hello-world nor the examples. after running them i cant find the apps on the emulator and the launch activity is not started either.
i use eclipse with ADT but also tried it via command line.
no errors in the console
any hints?
A few things you might want to check are the following:
Is your Android SDK attached to your eclipse.
Is your Android VD Attached to your PROJECT, not just to eclipse.
You need to go to the project->properties and then theres a place where you can attach the AVD and SDK to your project. I don't have eclipse right now to check for you, but If you dont get how tell me and I'll download it and check it for you.
Hope this helps,
kRizD

Categories

Resources