Gradle Project Sync Failed on Android Studio - android

I am new to Android App development.I installed Java Development Kit andAndroid Studio v 3.0.1 . There was no problem in downloading and installing Android Studio. The problem came when the time came to creat a new project. My instructor on the course told me the new project would take time to set up and configure. Mine took some 115 minutes. And after it came a Windows Alert Message mentioning that Windows Firewall has blocked some features of JDK library.
This is the screen shot of the Windows Alert Message.
Windows Alert Message
I just ignored the message, and clicked the Close button.
And when I see my newly opened project on Android Studio, I see the message that
Gradle Project sync failed.Basic functionlity will not work properly.
This is the screenshot of Gradle Error.
Gradle Project Sync Failed
I am clueless about what this Gradle is. Does this gradle error have anything to do to do with the Windows Alert Message I ignored? How can I fix this problem?
I want to create apps and just new to Android App development.

Windows Firewall automatically blocked Internet access for Android Studio and informed you about that in that dialog. Most programs, like Android Studio need Internet access, so in the future you want to click "Allow access" button whenever that dialog show up (for trusted software).
Go to Windows Firewall and in the "Allow a program or feature through Windows Firewall" option look for "OpenJDK Platform binary" and check both checkboxes.
Screenshot tutorial, but for Firefox

Related

SO_REUSEPORT Error in Android Studio Emulator

I get the following two errors when i try to run my program on the AVD:
Emulator: E0630 09:34:36.670338059 9681
socket_utils_common_posix.cc:201] check for SO_REUSEPORT:
{"created":"#1593498876.670313972","description":"SO_REUSEPORT
unavailable on compiling
system","file":"/mnt/tmpfs/src/android/emu-master-dev/external/grpc/src/core/lib/iomgr/socket_utils_common_posix.cc","file_line":169}
Emulator: queryCoreProfileSupport: swap interval not found
I use ubuntu 16.04 on an Hp probook 4540s
After unsuccessfully trying all my tricks, i reinstalled android studio (making sure to install it at no other place than the "/opt" directory) but the same problem still came up, however, the newest android studio at the time (4.0) with the newest gradle (4.0) came with a new feature which helped me out.
After creating a new project, instead of using the Build/play button to build the app for the first time, i used a button in the "What's new " section called Build Analyzer and after some minutes, i got the app successfully running in the emulator!
Although the app was running but the error kept been displayed on the screen until after running the app for a number of times.
the Feature is in the "What's new " (Assistant) section and can be reached by clicking: help>what's New in Android Studio scroll down the "What's new" pop up window until you see the "Build Analyzer" button then click it and wait for background processes to finish.

Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.

If the "Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled." issue occurs while using the latest Gradle Plugin & Latest Android SDK. You can use the below solution as mentioned in the screenshot
In your gradle file just enable 3 options as per the diagram (default always all options will be enabled).
This solution weirdly worked for me.
I don't know it is studio issue or something else with Gradle plugin. But Some one have better solution or exact solution please share across.
Enable your ADB Integration.
Go to Tools --> Android --> set checked in Enable ADB Integration
Go to -- app-->Edit Configurations-->Launch options
In Launch select --> Specified Activity
apply then press ok button.
now you may run the program
Firstly, If the Android Device Monitor is opened, close it and then select "Enable ADB Integration"
Hope this helps someone:
For me what fixed it was closing the Android Device Monitor
I could not Enable ADB Integration until then.
I ran into this error after opening my Android Studio 2.3.3 on March 25, 2019. The last time I had accessed my projects was earlier in 2018. I started Android Studio 2.3.3 and opened projects that I had previously created and ran fine. A bunch of stuff was broken. Apparently parts of Android Studio or dependencies, or related packages, had been updated in the background and that broke all my old projects.
Just to get Gradle to sync on opening projects, I had to download and install Android SDK 27. Fumbled through a few more issues which I will omit. I didn't do a good job of recording them and they are not pertinent to this question.
Finally got to the point where I could run my project and the emulator launched just fine but Android Studio wasn't able to start the project. It just sat there waiting. Closed everything and restarted. Tried running the project on an emulator again and I got Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.
Here is a screen shot of how the error displayed:
I referred to some of the other answers to this problem posted on this thread. Android 2.3.3 settings dialog is a little different than the newest Android Studio.
To fix the problem I went to "File -> Settings -> Build, Execution, and Deployment -> InstantRun". At the top of the dialog is a check box for "Enable Instant Run to hot swap code/resource changes on deploy. I attached a screen shot of my settings.
I closed and restarted Android Studio. Opened my project and clicked the run button. The emulator started and the compiled app launched. Problem resolved for me.

Cordova debug: the specified file was not found

I'm working on a Cordova project for Android using Visual Studio 2015. I can build my project without error and I can deploy it on Ripple.
But when I want to deploy on a real device or on an emulator, I'have always the same error: the specified file was not found. No more information in error list or output (using diagnostic output).
When I try to deploy on the emulator, the emulator receive the application and I can use it but when the app is lauched I have a pop-up from Visual Studio: "the specified file was not found" and I can't debug.
When I try to deploy on a real device, I have directy a pop-up: "there were deployment error. Continue ?" if I click on "yes", I have the popup "the specified file was not found".
I would like to have a solution and an explanation about this error.
Thank you in advance, I can't work with this kind of error except deploying on emulator and don't use debugging...
It seems like you are missing a third party component (such as Android Studio), so Cordova is creating an Android project, but Android is not compiling that project into an Android app. That's why it deploys on Ripple (which just uses the first half of the build) but fails on the second half. I'd make sure that you do have Android home set up (check the path in Tools->Options->Tools for Apache Cordova). Otherwise, feel free to email your question + current project to vscordovatools#microsoft.com. I can take a look at it on my machine.
Linda Zhong, Tools for Apache Cordova PM
Lizhong#microsoft.com

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.

How to create a project in Android Studio

I installed the android studio successfully but any time I want to launch an new project (after naming the activity),I get an error message saying "can't resolve host at service.gradle.com" How do I resolve this?
This sounds like a firewall of some sort is blocking Android Studio's connection to gradle. Check to make sure any antiviruses you have installed have Android Studio allowed through their firewall.

Categories

Resources