Build gradle fails even in new apps - java

I keep getting the same error
"Error:Execution failed for task ':app:mergeDebugResources' no servers to serve "
This happened after I installed glade via choco.
I deleted every folder of android studio(.gradle, sdk, projects, etc) and deleted choco in the %programdata% folder, I reinstalled android studio and keep getting the same error.

It looks like your gradle needs to be updated so that the folder is not private. Sometimes that error is "spat" when your folder with the project, for some reason, becomes unaccessible and you should redirect it via a chmod command in the terminal. That is what I did running Android Studio on Linux when I got the same error you are having.
Typed:
'sudo chmod 777 -R ~/Desktop/folder_project'
Where folder_project is the folder that I used when I put with root my android sdk.
A similar problem with yours, was faced by the person asking this Q: Android Studio - mergeDebugResources exception

Related

Cannot create service of type TaskExecuter using ProjectExecutionServices

Android Studio 3.6.1 Gradle Version 5.6.4
Gradle Buid Error
Cannot create service of type TaskExecuter using ProjectExecutionServices.createTaskExecuter() as there is a problem with parameter #22 of type ReservedFileSystemLocationRegistry.
Cannot create service of type ReservedFileSystemLocationRegistry using ProjectExecutionServices.createReservedFileLocationRegistry() as there is a problem with parameter #1 of type List<ReservedFileSystemLocation>.
had same issue, stopping Gradle using the command below fixed it for me:
gradle --stop
or if you are using wrapper, use:
./gradlew --stop
I simply had to restart my PC for this to get fixed. Unfortunately I didn't try this until after I tried most of the other solutions. 🙄
I also had this when I tried building on my ExFAT formatted ssd on macos. Reformatting it using APFS solved it.
did u face this issue in react native,
go to android folder
open the terminal
if u using vscode terminal(powershell) use -> ./gradlew --stop
otherwise -> gradle --stop
in flutter or react-native go to android folder and run this in cmd
gradlew --stop
next
gradlew clean
to rebuild android or simple so you can restart your computer and run your flutter or react-native project again
For me the source of this error was wrong permissions within the project. A sudo chown -R <username> . within the project's root fixed those issues.
For anyone who has their project on their external drive
Try moving it to your local drive
This worked for me
(MacOS Monterey)
I ran into the same issue when trying to deploy another project on the same virtual device. For me it was solved by selecting "Wipe Data" for that Virtual Device in Android Virtual Device Manager.
Backing up the answer from Alex. I got this issue when my project is in my external drive. I played around with device permission, file permission and even updated my android studio since I use VS Code for my flutter projects.
Finally made a sample project on android studio and thankfully got the same error message from Gradle. In this way, I knew the issue is not related to the VS code. As Alex said, I wiped the data from android device manager. But I got into some other issue. I let the virtual device to start completely and ran the project again and it worked.
I had the same issue until I disabled the "Use detected ADB location" under Emulator Extended Controls > Settings. Restarted the emulator and was able to "Run" without any errors occurring anymore. Preview of "Use detected ADB location" setting.
Creating a new project or performing a clean on any other project except the current one where the error exist solved the problem for me.
Remove the caches directory under c:\Users<Your user name directory>.gradle directory and do the build again. It worked for me.
I have faceed same issues in my flutter project for multiple build process and out of memory then I copy project from one folder to another folder and open project from android studio. It's working perfectly.
In my situation this worked, I'm using Android Studio on Windows 10
I installed JDK and added its installed path into my environment variable under name JAVA_HOME ([follow solution 2][1])
just added --stop run configuration on android/gradlew
[![enter image description here][2]][2]
4. ran android/grandlew
[![enter image description here][3]][3]
remove --stop that you did step 3 and click on okay
6.If not work just restart android studio and follow step 4 again
[1]: https://fluttercorner.com/solved-error-java_home-is-not-set-and-no-java-command-could-be-found-in-your-flutter-path-in-flutter/
[2]: https://i.stack.imgur.com/W77DF.png
[3]: https://i.stack.imgur.com/T9LWg.png
run this command on
sudo ./gradlew clean

Android Studio 0.8.2 URI has an authority component

I am getting "Gradle project sync failed." when I start up Android Studio. When I try to clean the project, I get "Failed to complete Gradle execution Cause: URI has an authority component"
I've tried several things already and am still stuck. I moved my config files out of my user folders and put them in my root directory where I have Android Studio. (C:/Studio). I've also tried to invalidate caches but that still didn't help. I'm on a networked VDI so I'm not sure if that might have something to do with it. Below is the message I'm getting from Gradle sync. Any ideas what can be going wrong here?
Gradle Sync Message:
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 http://gradle.org/docs/1.12/userguide/gradle_daemon.html
Please read below process output to find out more:
java.lang.IllegalArgumentException: URI has an authority component
at java.io.File.(File.java:423)
at org.gradle.api.internal.classpath.EffectiveClassPath.findAvailableClasspathFiles(EffectiveClassPath.java:41)
at org.gradle.api.internal.classpath.EffectiveClassPath.(EffectiveClassPath.java:32)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.(DefaultModuleRegistry.java:61)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.(DefaultModuleRegistry.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:41)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.daemon.bootstrap.GradleDaemon.main(GradleDaemon.java:22)
The only cause I've seen of this is if your home directory is on a network share (it has a Windows path of the form (\\UNC_PATH\... instead of something like C:\ for a local file). Gradle doesn't properly support that right now. There's a bug in Android Studio's bug database to track it:
https://code.google.com/p/android/issues/detail?id=56444
and it references a bug in Gradleware's bug database:
https://issues.gradle.org/browse/GRADLE-2941
The Android Studio bug report lists this as a workaround:
I also faced same issue. Reason I figured out that may be when I
installed Android Studio with option -- Install to current User. This
step installed .gradle folder in the organization Network Path
[\{network}\users{USERID}.gradle]
Resolution step: [On Windows 7 Machine]
Copied .gradle folder from path on network [\{network}\users{USERID}.gradle] to [C:\Users{USERID}.gradle]
In Android Studio v-(Beta) 0.8.6 [File --> Settings] changed Gradle Settings
Global Gradle settings
Service directory path: C:/Users/{USERID}/.gradle
Gradle VM options: -Dhttp.proxyHost={dummyHost} -Dhttp.proxyPort={dummyPort} -Dhttp.proxyUser={dummyUser} -Dhttp.proxyPassword={dummyPassword}
I had also given Gradle VM options because it tried to download
Gradle-0.12+-all.jar before compiling.
if you don't have a strong internet connectivity make sure you select the offline mode from the console. Selecting offline mode could solve the issue.

Unable to clean project in Android Studio

OS version: Ubuntu 14.04 LTE 64 Bit
Java JRE/JDK version: Oracle JDK 1.8.0_11
Project directory is on a NTFS based drive.
Whenever I try to clean my project I get something like below.
:app:clean FAILED Error:Execution failed for task ':app:clean'.
Unable to delete file: /media/DriveA/AndroidStudioWorkspace/DNA/app/build/intermediates/classes/debug/.../mechandising/MerchandizingActivity$3.class
When I try to delete the build folder manually I get the following error.
Error when getting information for file
'/media/DriveA/AndroidStudioWorkspace/DNA/app/build/intermediates/pre-dexed':
Input/output error
I am unable to figure out whether its a Linux problem or a Studio problem. I don't face such a problem in Eclipse (Same Drive) so I am just considering it to be something wrong with my studio.
Any Suggestions??
I had the same problem.
You need to go to the source file directly.
Close the studio and go to the path the issue is located at and delete the folder there.
Go to
File > Settings > Build, Execution, Deployment > Instant Run > Uncheck
this Check box (Enable Instant Run to hot swap code)
Thanks
Have a nice coding
You can go into the project directory and call gradle from the command-line to do a clean on the project:
gradlew clean
When you reopen the project you will need to run a gradle sync again.
Just ran into the same issue now - I accidentally edited one of the generated files and wanted to rebuild the app, but both clean and build failed due to some files being locked.
Luckily, I got cygwin on my Windows machine, so ls -l <file that studio complained about> revealed that these files were owned by some Administrator dude.
My first thought was that these files might had been created while Studio was running with admin privileges (I do this when I need to fetch updates from SDK manager). The idea was to try and resolve this issue by executing clean in Studio running with admin privileges, and later rebuild with normal privileges. Nope, this did not work :(
I decided to go for the brute force: sudo rm -rf app/build/* (in Cygwin this command looks a bit different: cygstart --action=runas rm -rf app/build/*). This resolved the issue and I was able to rebuild the project in Android Studio.
I had the same issue as you. I tried some of the solutions proposed on this page and it didn't work. So I used Process Explorer to find which process is locking the apk file and it was firefox. I think it keeps the file locked when I upload the apk in google play console. To make that go to "Find > Find Handle or DLL... > path-to-your-app.apk".
Hope it help
On Linux this could happen if you have a locked directories that prevents Android Studio from Deleting files.
you can run the Following command on Terminal:
sudo chown -R $USER: $HOME
Then try to rebuild --> Works for me
I stopped the windows defender it was locking the file because it was need to scan , and the problem resolved
Go to your projects directory in the terminal and run gradlew clean
To run a Gradle command in your terminal/command prompt. Navigate to the root of your project and type gradlew in the terminal or gradlew.bat for the command prompt (windows users), followed by the command you would like to execute.
For a list of all possible gradle commands type gradlew tasks into your terminal.
I had a similar problem, when I was trying to debug my first android app. If you are running Android Studio on windows, I just restarted the Android studio and I did run Android Studio as Administrator which fixed the issue.
I solved this issue by closing android studio -> remove android platform via cli and then -> add the android platform again -> open project in android studio.
I'm not on Windows, but OS X. Somehow my build folder didn't have the proper permission for AS to delete the file so I did chmod -R 777 <your_directory> in the affected parent directory.. probably 777 isn't what you would want but it worked for me.
Thanks to Gal's answer (https://stackoverflow.com/a/39904628/2870404).
In windows, using Windows file explorer,
right-click on the directory,
click properties on the context menu that will appear,
then uncheck the "Read Only" attribute.
After that, click the "Apply" to apply changes.
This fixed my problem.
Thanks to Gal's answer (https://stackoverflow.com/a/39904628/2870404).
In windows, using Windows file explorer,
right-click on the directory,
click properties on the context menu that will appear,
then uncheck the "Read Only" attribute.
After that, click the "Apply" to apply changes.
I had the same problem.
To build the project again and again I had to delete the build folder each time. The problem for me was an anonymous program called ByteFence.exe running in my system. When I uninstalled that program my issue was solved.
none of above answers didn't work for me, but change permistion works:
chown user:staff ../project_dir
find ../project_dir -type d -exec chmod 775 {} \;
find ../project_dir -type f -exec chmod 664 {} \;
It should be a process lock the file handle. You can try to open your task manager to kill the process. In my case, the process is one of the Java process hold by Android Studio OpenJDK. Just find it and kill it.
I came to this thread because I was having issues with my /release/app.aab getting locked. This prevented me from completing a project clean and generating a signed bundle. My work around was to restart my computer to get permissions back until I solved the issue.
It turns out that Git was locking the app.aab, and all I had to do was add "/release" to my /app/.gitignore.
Hope this helps someone.
1) Go To File > Settings > Build, Execution, Deployment > Instant Run > Uncheck this Check box (Enable Instant Run to hot swap code).
2) Restart your android studio
Running android studio as administrator in windows worked for me. :)
1) first run cordova clean cammand
ionic cordova clean
2)After that run build command
ionic cordova build android
I solved it by Upgrading gradle version in build.gradle(project)

eclipse throws AndroidManifest.xml file missing deployment error, though the file exist

I'm using eclipse android IDE (bundle)
a strange thing,
I have build my android application successfully (no errors)
it includes android Apllication project and a native c code project.
I try to run the android project on my android-device
and get this error:
Description Resource Path Location Type
AndroidManifest.xml file missing! WazeAndroid Unknown Android Packaging Problem
Although I see it in the package tree.
I have googled. tried t restart eclipse and my Mac
nothing helped.
Go to Project in menu and do Clean your project which one you selecting then run your program.
Here is a google offical solution
To fix this problem, simply delete the debug.keystore file. The default storage location for AVDs is in ~/.android/avd on OS X and Linux, in C:\Documents and Settings\.android\ on Windows XP, and in C:\Users\.android\ on Windows Vista.
The next time you build, the build tools will regenerate a new keystore and debug key.
I hope that this can help you.

assembleDebug error in Android Studio

I have updated to the latest Android SDK and set JAVA_HOME in .bash_profile using
export JAVA_HOME=$(/usr/libexec/java_home), and I'm getting the following error:
Error Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assembleDebug' not found in project ':CrystalBall'.
* Try:
Run gradle tasks to get a list of available tasks.
Error: Could not execute build using Gradle distribution
http://services.gradle.org/distributions/gradle-1.6-bin.zip
I've attached a screenshot:
What should I do?
The second error in your screenshot seems more important to me. You have to make sure, that the Android Studio is able to download and execute the gradle binary. If you are using a proxy you have to configure it in the Android Studio.
To check the gradle tasks, go to your project folder on the command line and type "gradlew tasks"
You can also configure a proxy for gradle. Just create a gradle.properties file in (your project folder) with these properties:
systemProp.http.proxyHost=www.example.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxy.com|localhost
I don't believe this is the issue the poster had, but for the benefit of others I'll add what I found as I was helping someone on Windows XP who was getting the same error.
It appears the issue in his case was that the path to the Android Studio project had spaces in it (since Windows XP uses the Documents and Settings directory). I had him generate a new project into a directory without spaces in it and it built and ran without problems. Might have actually been something else, but as usual it is best to avoid spaces in paths.

Categories

Resources