Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
I started following the Android track after I installed the tools. After the FunFacts segment, I found it difficult to keep up using different tools, so I decided to install the suggested version. Hilarity ensued. Now I have a mess! I've unintalled SDK and AS, and reinstalling the suggested AS keeps giving me errors that I don't have the 2.2.1 platform installed, and I'm stuck.
I'll try my best to guide you through removing all of the Android Studio files on a Windows System. Note that some files may be located in a different location depending on where you chose to install and the versions you've been using so if something is not in its normal place, please let me know.
If you want to delete any of your previous projects, the directory where your projects are found is the AndroidStudioProjects directory. It is located in your root user file, C:\Users\[YOUR WINDOWS USERNAME]\.
First of all, thank you for taking time out of your day to help. I did all that, then followed the instructions Ben put forth in the "setting-up-an-android-development-environment-for-windows" almost to the letter - I put Android Studio in C:\Program Files\android-studio.It started up OK, and I opened the project, which presented only one gripe, that AS used to be in C:\Program Files]Android Studio\android-studio. After a build attempt, I get a message similar to the one I had before:Installing Archives: Preparing to install archives Downloading SDK Platform Android 5.1.1, API 22, revision 2 URL not found: C:\Program Files\android-studio\sdk\temp\android-22_r02.zip (Access is denied) Done. Nothing was installed.
Figured it out. Doh. I had installed SDK under \Program Files\, and Windows (silently) objected to that, disallowing such fun things as fetching android-22_r02.zip, which subsequently could not be found and unzipped.
I recently had trouble with this, and regardless of what I did(restart adb, edit adb_usb.ini, restart computer+device+swap usb port, reinstall studio etc. etc.) I just couldnt get it to work, and could not even detect my device using 'adb devices'. Finally after about 2 hours of googling and testing, someone suggested switching to PTP instead of MTP on my device. When I did this I got a popup on my device asking me to allow my mac access and suddenly everything worked(had to restart studio for it to show up there as well though).
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
That seems to be where you toggle what the project builds to. If you're importing a project it actually defaults to Emulator, not sure why. You can also select "Open Select Deployment Target Dialog" to list both connected as well as emulated devices.
Some USB3 ports are causing issues too. Not sure if there is a way to check if the cable/usb works. But there is a way to detect the USB type USB2 or USB3? . If you are using USB3 could be a port issue too.
After spending some time I found the problem was to enable USB debugging option to on. Just find in your mobile Settings->Developer Option->USB debugging. Just enable it and it works.It might help someone!
In case you do not see the Developer Option then try to enable it first:Depending on your device and operating system, you may need to go to "Settings -> About Device or About Phone -> Software Information", then tap "Build number" seven times.
Go to device manager (just search it using Start)and look for any devices showing an error. Many androids will show as an unknown USB device and comes with exclamation mark. Select that device and try to update the drivers for it. for update part follow the link:universal adb
When done, the driver files are downloaded into the \extras\google\usb_driver\ directory. Hints: Search "android_winusb.inf" under Windows Start and Open File Location to get the directory mentioned.
Open up your device manager, navigate to your android device, right click on it and select Update Driver Software then select Browse driver software. Follow the file location path previously to install Google USB Driver.
On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
For PTP , go to settings..storage..usb connection..PTP (For MTP/PTP , maybe on my nexus it's there, but on my doogee I see it under 'developer options' .. then under networking , above input, it says "select usb configuration")
In Windows, right click on Computer, and go to Device Manager, check if you have Android Device right on the root folder and under it should be Android Composite ADB Interface. If you don't have this, you have to download the Google USB Driver. Get it here:
Sometimes, the phone is not detected even with USB Debugging on. In this case, tap on Revoke USB debugging authorizations in Developer options. Grant the required permissions on reconnecting the phone.
Be sure that you have downloaded the correct API for the version you device is using. After updating your device's Android version or switching to a different device you may not have the correct API downloaded on Android Studio. To do this:
When I faced this problem I was on Android Studio 3.1 version. I tried a lot of approach above, nothing worked for me ( Don't know why :/ ). Finally I tried something different by my own. My approach was:
I am working on the building an interactive story app on the android track, reinstalled Android Studio, and launched the emulator from AVD manager. The only problem is that the window for the emulator isn't movable/it's as if the window is locked to the very top of the screen with no close, resize, or minimize buttons being shown. I'm on windows and I can't figure this out as it is pretty frustrating when I can't move the emulator out of the way while working.
Thanks George. This works for moving it around, but I can't help thinking something isn't configured right. Why would the emulator window be locked like that? This didn't happen in an earlier version of Android Studio.
Well to be honest, I had same problem and I could not solve it. Instead I went for Genymotion emulator, which works a lot better. You should really try it out! There is even a course about it on Treehouse
I have wasted a whole day trying out different solutions floating around in SO and other place mentioned to enable wifi on the android emulator but to no avail.Can anybody help me figure out how do I enable internet on my android emulator?
Edit: This is the fix for a situation when the emulator's wifi has changed the DNS to some non-working DNS. While this works most of the time, there might also be other reasons which may not fix from this solution.
The older answers to this problem no longer work after 2020 (Using Android Studio 4.1.2 or newer). The problem is the DNS settings on the Emulator. It no longer works to just change the DNS Servers on your local PC. You have to change the DNS settings within the Emulator. The following steps are for an emulator running Android 11. Other versions will be similar:
@TheBaj : I figured the problem with this and fixed it. The problem is when you are connected through the router, the androidwifi in your emulator uses the settings and the sets the DNS to something other than 8.8.8.8 which is the google DNS(I presume this is kinda mandatory setting for the androidwifi to gain internet access). But if i change the DNS in my network settings, the google-services plugin which fetches your dependencies especially the one's getting downloaded from jcenter() will not be downloaded and hence your sync will fail which eventually fails your build.
So the trick is that you have your google DNS(8.8.8.8) configured in your network settings after your default router settings - this part takes care of downloading the dependencies from jcenter() and the sync and build succeeds.
On Mac OSX (Catalina for me), the problem is caused by the fact that the emulator automatically picks up the nameserver by looking at /etc/resolv.conf and picking the first one, in my case an IPv6 address. Source: -networking#dns
Maybe this would help someone. I tried all the solutions above. Changing DNS, cold booting, etc. After several hours of trial and error, I went to the official docs, which said that the emulator picks up the DNS config. of host machine at emulator's boot time.I had VMWare installed on my machine, which installs a few network adapters. So, I just changed the DNS config. of all the adapters (including VMWare adapters), and cold booted my emulator. OMG, the problem which didn't seem to go away for hours, just got right!
I hope I save someone a lot of pain, I tried everything everyone said on here, changed the DNS of every network adapter, reinstalled everything, the SDK, the emulator, even android studio, nothing worked, if you find yourself in the same position check if you VMware installed, if you do, don't bother with the DNS just go into Control Panel->Network and Sharing Center->Change Adapter Settings, and disable any and all VMware Network Adapters, then Cold Boot, fixes the issue instantly, you can even enable them later, and it still works
7fc3f7cf58