Android Studio Gradle Error - Protocol Family Unavailable - android

So I am relatively new to Android dev. and have been getting Android Studio set up on my computers. I have it set up just fine on my Mac. When I downloaded and installed it on my Windows 8.1 desktop the gradle build seems to fail every time. With an error message stating that the Protocol Family Unavailable. I've tried several things including uninstalling and reinstalling Android Studio.
NOTE: I did try what was said to work here Gradle project refresh failed - Protocol family unavailable yet it did not solve the problem for me.

When I used Stunnel I faced this problem and my problem was solved when I disconnented it.
Check too see if you have any Stunnel, Vpn or Proxy connection and if so, disconnect it.

I also had this problem and the referenced thread also didn't work for me.
What did work was setting _JAVA_OPTIONS environment variable to make Java use IPv4.
_JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true
Note that Android Studio sets this variable in the vmoptions file. But for some reason, it isn't used by the Java VM started by Android Studio to run Gradle daemon.
After I did that, everything started to work ok and Gradle could build my project.
I hope it helps.

I run into this problem when my firewall blocked studio64.exe from connecting to the internet. I fixed it by granting access.

You could try to fix it temporarily by disabling your anti-virus software while using Android Studio. I'm not entirely sure it will work, but it's worth a try, it worked for me, though I'm aware-, and agree with that this is far from a permanent fix, but it might be good enough while waiting for a fix from the Android Studio team, at least it will let you keep working!
Hope this helps!

"Run command prompt as administrator - type cmd in the 'search programs and files' text box in the Windows Start menu; right-click and select 'Run as administrator'.
At the command prompt, type
netsh winsock reset
Restart your PC
This worked for me."
I found it in
Android studio "Cannot start internal HTTP server"

My problem was using a VPN on an per-app basis connection mode while Android Studio was blocked.

I solved same problem by disabling antivirus.

for me proxifire.exe was running in background and cause to connection problem, after closing problem gone

This answer is same as first answer in this topic, means first answer is true and works well, but my answer is in detail, i did not set that variable, just turn off proxy.
This error arises due to proxifier running that basically tunnels the computer in ipv6 which is not supported by daemon.
So to overcome this and build project either close the proxifier application from system tray or add the environment variable
_JAVA_OPTIONS= -http://Djava.net.preferIPv4Stack=true

Related

Android studio isn't opening [duplicate]

Every time I run Android Studio, this loading screen pops up, but Android Studio stays here and doesn't load. It's like this following picture except that the loading bar is loaded all the way but stuck there. I am running Windows 10.
I have tried many things, including setting the system variables JDK_HOME to where my JDK is located and the same for JAVA_HOME. I have also set a path. I ran as admin many times and let AS through a firewall.
I have also restarted and reinstalled countless times.
The version of AS is 2.0, and I am running the latest versions of Java.
Any help?
Open file Android Studio setup directory/bin/idea.properties
Add disable.android.first.run=true to end
Restart Android Studio
PLEASE NOTE: This will break patch updating to the next version. We
now check full binary checksums on the whole installation to prevent
various install corruption bugs as well as to preserve application
signatures. Therefore, make a copy of this file first, and before
updating, put it back.
Please try the following method to fix that issue:
Find the folder of your AndroidStudio: based on the following directory
macOS: ~/Library/Application Support/Google/AndroidStudio[version]
Delete the AndroidStudio folder.
Restart
Ref:https://developer.android.com/studio/known-issues#studio-config-directories
In order to know how to debug the problem, I executed the bin\studio.bat script in the terminal and inspected the actual Idea exceptions in order to fix the problem.
For me, this was the issue:
ERROR - llij.ide.plugins.PluginManager - java.net.BindException: Address already in use: bind
java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bind
This means the plugin manager is trying to listen on a port that is not available. Is something listening on that port? For me, it was the stupid "excluded ports" by Windows, so I simply stopped the service:
net stop winnat (as administrator), and confirmed that Android Studio started to work.
No need to re-install, delete precious configuration (and plugins, etc.). Just read the log provided by the bin\studio.bat script, and I was able to fix the issue.

Gradle Daemon Android Studio: "Unable to start the daemon process"

I am having a problem. I have always developed applications in Android Studio and never had a problems, but now I had the following error:
Unable to start the daemon process. This problem might be caused by
incorrect configuration of the daemon. For example, an unrecognized
jvm option is used.
Please refer to the user guide chapter on the daemon at
https://docs.gradle.org/4.4/userguide/gradle_daemon.html
I already changed in gradle.properties the following line
org.gradle.jvmargs=-Xmx1536m
to
org.gradle.jvmargs=-Xmx1024m
I also delete the folder .gradle in Users.
Check your local firewall. I found an update of the firewall in my AV software to cause the same error. When I disable the firewall, the demon start succeeds.
I had the same problem on 3 different PCs. I disabled the firewall and everything worked just fine. Even if my IDE is not blocked by the firewall.
I am using BullGuard's firewall on Windows 10 Home. Maybe there is a better way to solve this problem, because I actually don't want to disable the firewall everytime I start programming with gradle and java.
At least this worked just fine for the beginning.
Check your local firewall. I found an update of the firewall in my AV software to cause the same error. When I disable the firewall, the demon start succeeds.
just disable antivirus then try again ;)

Android studio's emulator is not connecting to internet

I'm using windows 10 and android studio 3.0.1.
In past, I was able to use internet at my Android emulators but now, I'm not !
I saw similar topic in stackoverflow but answers not working for me,
what should I do ?
try this command on windows cmd while replace the path with your own.
C:\Users\prashant\AppData\Local\Android\sdk\emulator\emulator.exe -avd Nexus_5X_API_25 -dns-server 8.8.8.8
If this doesn't work try genymotion, it's best. Here
Finally I found the answer!
I'm using proxy in my android studio and emulators by default using android studio proxy setting too!
I just disabled proxy in emulator and problem solved!
you need to enable your internet conection to share with another conected devices, once you do it restart the emulator and you got internet
this works for windows
go to your conection properties
go to sharing tab
click in "Allow other network users to connect through this compueters connection
I had this issue and finally I realized the problem is because of my firewall (Kaspersky).
Go to in firewall application settings and search 'Android studio'.
You may find several applications with the same name, allow all of them to access Internet.
For me, there were 2 apps including JetBrains extension, which i had blocked long time ago!
This problem appeared out of nowhere for me after updating Android Studio to Chipmunk. After a great deal of searching and trying different solutions, I found one on Medium.com that solved it! This is a very similar fix that Prashant posted (setting the DNS server to 8.8.8.8), but it gave a step-by-step solution without using terminal, and included adding 8.8.4.4 as well.
DNS fix for Windows or Mac

Android studio "Cannot start internal HTTP server"

I'am trying to install Android studio, but bad luck..:-(.
Windows 7
Latest Andriod studio
Latest Java
Installed the latest Java and also added it to the system settings according to http://www.youtube.com/watch?v=TTrUX1kUpDo
Also downloaded Gradle and updated the system settings
Stopped all firewall actions
So far so good, Android studio is also starting without any problems. But then I get two messages:
Internal HTTP server disabled: Cannot start internal HTTP server. Git integration, JavaScript debugger and LiveEdit may operate with errors. Please check your firewall settings and restart Android Studio
Gradle 'Nieuwproject' project refresh failed: Connection refused: connect
So after a few days of trying I was hoping that somebody could help me out..:-)
Here's what worked for me - I got the same error:
Internal HTTP server disabled: Cannot start internal HTTP server. Git integration, JavaScript debugger and LiveEdit may operate with errors. Please check your firewall settings and restart Android Studio
Run command prompt as administrator - type cmd in the 'search programs and files' text box in the Windows Start menu; right-click and select 'Run as administrator'.
At the command prompt, type
netsh winsock reset
Restart your PC
This worked for me.
Just to mention: I also added Android Studio and Gradle folders to my virus protection exceptions in case it was being blocked, but that didn't resolve the problem; the problem was only resolved once I followed the steps above.
Turn OFF firewall then turn ON again.
Sometimes firewall blocks it automatically when you start your PC. It also blocks to internet browsing for other reason but restarting firewall may solve this problem.
I encountered this problem after uninstalling Avast from my Computer,few days later i installed Avast again and the problem went away,Dont know what the connection is but thats what solved my problem
if Shell&ServicesEngine is installed on your computer, uninstall it and restart the Android Studio.

Android: unable to evaluate locals while debugging in eclipse

Ever since updating my android sdk and eclipse plugin, I cannot see the values of local variables while debugging in eclipse. This worked fine previously. Has anyone else experienced this and found a solution?
Late edit, but an important note:
This only happens for classes in projects marked as "Is Library". I have 2 projects, one of which is marked as an android library, the other of which utilizes this library. When I run an activity from the second project, I can evaluate local variables for its classes but not the library classes.
Sometimes, I have the problem that I have to reboot Eclipse cause it is not connecting correctly to the emulator(or the device) on debug-mode. Otherwise, you can also try by going to your
/android-sdk/platform-tools/
folder and there, run adb.
You can try to reboot the demon and so on by running
adb kill-server
and after, start it again by:
adb start-server
Hope it is going to work.....Otherwise the other solution could be to reinstall the Android plugin to see if there was a problem there....
Try one of the two things:
Window -> Reset perspective..
Just close that "Variable" window and reopen.
Would you like to share the code with us?
Try with
Window>Preferences>Java>Compiler>Compliance and Classfiles
check ON "Add variable attributes to generated class files (used by debugger)"

Categories

Resources