Android Studion Dependency resolving hangs - android

I'm trying to learn building android apps, but I have ran into the following problem.
After I create a new project, the Gradle build starts and it is hanging at the following process.
I am inclined to believe that the connection that I use blocks several ports and it is impossible for the studio to download the necessary file.
Knowing this, I downloaded gradle from their homepage, and I've set the local path in android to that folder, but there is no change.
This is what I get after the gradle build times out.
What can I do to bypass my connection settings and build a proper project?

If you have enough traffic,you can open you mobile hotspot ,then computer connect to the wifi.So,create a project and Gradle,have a try!The junit package isn't very big.Hope can help you.

Related

Unknown host (my proxy ip). You may need to adjust the proxy settings in Gradle in android studio

I used to run android studio through a proxy, it was called "wall" so I had it configured that way.
I upgraded to Android Studio 3.2 and additionally had to stop using it so I am connected to the internet through a proxy free connection.
I went to my settings->Appearance&Behaviour->System Settings->HTTP Proxy and set the option to No proxy
I search throughout my project for a reference to wall and I couldn't find anything
However when I try to build, gradle tries to download a file ( 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.61/kotlin-gradle-plugin-1.2.61.pom' ) which I can download normally through my browser and I get the Unknown host 'wall'. You may need to adjust the proxy settings in Gradle.
I tried with a brand new project and get the same.
I tried deleting the C:\Users\(username)\.AndroidStudio3.2 folder and again the same message.
Can someone please provide me with a solution?
After some hours of searching it seems that the problem was that gradle seems to keep a backup of gradle.options (or I may have done it through an option in android studio) in C:\Users\(username)\.gradle\ so even though I removed all references to my proxy, it still kept those and ignored the gradle.properties file in my project.
When I removed the entries to my proxy, it worked fine

Gradle sync failed

I am completely newbie for Android studio and Android development. Any help would grateful. I am using Android Studio version 2.3.3.
After I created a project I am getting below error.
Your latest installation of android studio 2.3+ doesn't have the dependencies , so you need to download it
1.) Connect to internet
2.) Run gradle synch or run your program
3.) Let the gradle download these dependencies
Note : it will be a one time process and will not be required for other projects
I had the same experience. I just used VPN and then let the gradle download dependencies(by clicking on sync button in build.gradle).For me it wasn't needed to change any proxy settings in android studio.
Thanks all for your quick response!!
To my surprise this has started working connecting from personal internet. Still wondering why it was not working with office network!!

Ionic build succeeds but does not create .apk file

I was always able to build from this project, this just started happening this morning. When I run ionic build android everything runs smoothly and the build succeeds, but the date modified on the android-debug.apk file stays the same, and I don't see my changes when I run it on a device.
Could it have something to do with messed up permissions and somehow it doesn't have permission to write the apk? I'm running Ubuntu-server 14.04.4.
I know it's been answered before but I'm adding this to let you guys know what I've tried and how it's not working anyways...
I've also faced same issue and tried several things like
Renaming APK file, expecting it will create new one.
Deleting build folder, expecting as usual will create new one.
opening project in Android studio, expecting it will create new one when I use it to launch the APK to device.
I've tried calling ionic prepare platform before calling ionic build.
The ionic build is a proxy for cordova build command.
But in this issue all of above approaches were failed.
The reason I can see behind this is because of no proper response/function of added platform to your project, as when you build it's cordova platform android's responsibility to prepare build on your command. Which is not working.
Lot of people suggests that You need to us ionic/cordova restore, this will restore your state.
Another way is you can use Android Studio's build APK option which helps you not to disturb your plugins by restore or reset commands.
Hope this helps you save your time from trying all these approaches.
Could it that you are looking at a wrong place?
When build command is successfully finished you should see smth like below in console
Built the following apk(s):
<PATH_TO_YOUR_SOURCES>/platforms/android/build/outputs/apk/android-debug.apk
Are you checking this this location?
Okay so the problem isn't with Ionic, it's just that the changed files aren't showing up in the ftp for some reason. So now I will try and figure that out.
As suggested by #mobileevangelist , ionic cordova restore can be done using command
ionic cordova prepare
It fixed my problem.
Try to
Open Android Studio
Choose Import project
Select YourProjectDirectory/platforms/android folder
Choose Build -> Build APK

Android Studio stuck while building application

I recently switched from Eclipse to Android Studio because I read that it is now the official IDE for Android application development. I downloaded and installed the latest version (1.0.2) for Windows. When using the program for the first time, I decided to create a test application to see if the program was working correctly. Unfortunately, it was not. Once I clicked the finish button to complete the New Project Wizard, A loading bar showed up that said Gradle: Build. This is where the program gets stuck. There is no error message and it appears that the program is running fine, however the build never actually completes. I am never given my MainActivity.Java class, or my activitymain.xml document. If I click the cancel button, the program freezes and I have to use the TaskManager to kill the program. If I re-enter the program and choose to open an existing project, my project will be there. However, upon trying to open the project, I am greeted with the same Gradle: Build loading bar.. I have been searching for an answer for the last 3 days and nothing has worked. Any help is greatly appreciated!
Things I have tried:
Simply letting the program sit for a while to see if it was actually downloading something and was just really slow. I let it sit for 45+ minutes before killing the program.
Uninstalling and re-installing Android Studio
Restarting my computer
Turning off my firewall (Kaspersky)
Running the program as an administrator
Connecting to a different network
Disconnecting my computer from any networks (to force the program to build in offline mode)
Manually downloading Gradle from the link that Android Studio attempts to use when it gets stuck and telling the program to use that file instead of downloading another one.
(I went to this link https://services.gradle.org/distributions/gradle-2.2.1-all.zip, downloaded the file, unzipped it, went to Gradle settings in Android Studio, checked the Offline work checkbox, and finally set the service directory path to my unzipped Gradle folder.)
Hopefully I have given enough information and made it clear what my problem is. If not please tell me what else I need to explain so I can get this issue resolved. Thanks!
Please note I am working on a 64 bit machine running Windows 8. Also, I use studio64.exe
to run the program.
From the discussion we had in the comments, it does not look like you have your gradle on your windows path.
Please change the below to point to your gradle install:
set GRADLE_HOME=C:\<installation location>\gradle-1.11
set PATH=%PATH%;%GRADLE_HOME%\bin
After this, verify that in the terminal running the following works:
gradle tasks
once you get this working, you will want to run the following in your project:
gradle wrapper
This will produce a .bat file which you can then use to run gradle through the wrapper, letting you support multiple native gradle installations.

Android-Studio: Gradle projects won't build without internet connectivity even in "Offline Mode"

I've recently shifted to Android-Studio from Eclipse simply because of it's automatic code completion feature which I fell in love with. But Android Studio is giving me a hard time from the moment I installed. It is laggy, it freezes often, but the main problem is that it does NOT build my projects without connecting to the internet. I found this question where I found that we can build gradle projects without connecting it to the internet by enabling the "Offline Mode" but it doesn't work for me. Even if I set gradle to local distribution mode, Android Studio automatically changes it to default settings, which is really annoying. I've no idea what's wrong with Android Studio. I'm using version 0.4.6.
The event log shows this -
11:13:26 PM AssertionError: Already disposed: Already disposed
11:13:42 PM Failed to refresh Gradle project 'Study Buddy'
Unknown host 'repo1.maven.org'.
Please ensure the host name is correct. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle.
HTTP proxy settings Open Gradle documentation
However, when I connect to the internet gradle builds the projects without any error. But I want to use Android-Studio in Offline Mode since I've a really low bandwidth. Please help to fix this issue.
Offline mode works only after you've compiled one time online. I know, it doesn't make complete sense if you don't understand everything on how Gradle works. But, you have to compile one time online and then it works.
This of course is a moot point if you don't have access to an internet connection at the time you wish to compile. Or, if you're like me, it just doesn't work due to your company's proxy and firewall rules.
I did get it to work at my company but the latest upgrade broke it. And now, even the previous version doesn't work, but I think that was my company as well. They pushed out some "patches" and I think that's what broke it.
You should upgrade. Offline support has improved since 0.4.6; it's mentioned in the 0.5.0 release notes: http://tools.android.com/recent/androidstudio050released

Categories

Resources