Android Studio 4.1.3

0 views
Skip to first unread message

Kathy Douds

unread,
Jul 26, 2024, 3:33:19 AM7/26/24
to barcampdakar

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

Just close your emulator and select the "Cold Boot Now" option on the drop menu adjacent to the play button. If not look for any of the more comprehensive options listed here, but I suggest always starting with the simplest solution.

For new searcher users:Sometimes VPN is your solutionChanging of network setting is not possible always because of networking issues.If you are in ip addresses that google does not responding for these regions,your solution is using of vpn.Use a proper vpn (a vpn that trough it you could update your android studio).When your vpn is on start your avd device (ofcourse api level of your emulator is important for example I have not any problem with api 22 but for api 28 is need using of vpn !).This was my experience about android emulator internet.

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 installed android studio and it crashed several times. I installed an older version (Arctic fox) and it did the same. It never managed to install gradle. I installed gradle via the command line (using apt). Then android studio complained that the gradle libraries were newer. And crashed. I installed the latest version of android studio via the command line. It goes a bit further sometimes, I was able to create a new project and to give it a name. But I can't do anything else.

It doesn't always crash at the same stage. It starts doing something, for example indexing files, and then it crashes. Currently, it's going to crash while building gradle. I test it by moving the mouse pointer. When the mouse pointer stops moving completely, I know nothing else is going to happen and I press the button.

Is there a way to contain it, to slow it down, to stop it from using all the RAM? I wouldn't mind giving it more time to finish whatever it thinks it's got to do, even leaving it to run overnight, but I would like the rest of the computer to remain functional.

Is there any lighter alternative? Should I reinstall lubuntu and everything leaving out the android preview? (Anyway I can't use it currently because I never found the "Split" button which google mentions in it's android tutorial). I don't really mind doing a new lubuntu install as this is a new machine. I have nothing personal on it except a nice desktop wallpaper.

When creating a new app, some Flutter IDE plugins ask for an organization name in reverse domain order, something like com.example. Along with the name of the app, this is used as the package name for Android, and the Bundle ID for iOS when the app is released. If you think you might ever release this app, it is better to specify these now. They cannot be changed once the app is released. Your organization name should be unique.

If the Run and Debug buttons are disabled, and no targets are listed, Flutter has not been able to discover any connected iOS or Android devices or simulators. You need to connect a device, or start a simulator, to proceed.

To view the performance data, including the widget rebuild information, start the app in Debug mode, and then open the Performance tool window using View > Tool Windows > Flutter Performance.

To see the stats about which widgets are being rebuilt, and how often, click Show widget rebuild information in the Performance pane. The exact count of the rebuilds for this frame displays in the second column from the right. For a high number of rebuilds, a yellow spinning circle displays. The column to the far right shows how many times a widget was rebuilt since entering the current screen. For widgets that aren't rebuilt, a solid grey circle displays. Otherwise, a grey spinning circle displays.

Reply all
Reply to author
Forward
0 new messages