Could not setcwd() (errno 2: No such file or directory) - android

After running my project I encounter following error in android studio.
Do you know the reason?
10:04:15 PM: Executing task 'installDebug'...
Could not set process working directory to '/Users/mahdir/.gradle/daemon/4.8/:app': could not setcwd() (errno 2: No such file or directory)
10:04:15 PM: Task execution finished 'installDebug'.

For me
Close the project and remove it from recent project list.
Go to the project directory and remove .gradle & .idea directory.
Import this as existing project again.

For me Invalidate Cache / Restart worked.

I saw this error when I had an invalid "Gradle project:" specified as part of a Gradle Run/Debug Configuration in AS 3.2. It's a free text field but better to use the folder icon to the right of the field to ensure you are selecting a valid project.

For me, I had a Gradle project in the project I had opened, but hadn't imported it (as a Gradle project).
I fixed the issue by:
right-click on the build.gradle file in the Project window
select "Import Gradle project"
run tasks directly from the Gradle tool window

I guess the module is not properly selected in the run/debug configuration.
Before you try the whole unlink/link roundtrip just do:
Open the Run/Debug Configuration dialog for the config in question by
clicking on the dropdown to the top left (see Run/Debug Configuration Dropdown)
clicking on Edit Configurations... (see Configuration Dialog)
Click on the icon right next to the Gradle project field and re-select the module of your choice (see Gradle project selection)
Try running the run/debug configuration again.

Related

apk does not exist on disk with a new Project

At the moment i can't build a new Project. (The project has only one empty activity) I don't know why is not build..
I get the error:
C:\dev\testapp\app\build\outputs\apk\debug\app-debug.apk does not exist on disk.
Error while Installing APK
I have tested with clean and rebuild, build apk, make prject, invalidate cache/restart but noting has helped.
see: The APK file does not exist on disk
and: EmptyThrowable: The APK file *.apk does not exist on disk
I do not have a buildfolder in the projectdirectory/app and this is not created at build APK
existing projects work flawlessly
does anyone have an idea of what it could be and how can I fix it?
Edit: when i delete the buildfolder on an existing project i also have this error..
First:
Go to Run -> Edit Configurations...
Make sure you have a "Gradle-aware Make" on the Before launch section:
To add it click the + sign and select Gradle-aware Make and a popup will appear, just leave the text field empty and click OK and OK.
Second:
Third:
Make sure that you don't have apostrophe or & in your path
Fourthly:
Deleting the folder .AndroidStudio[version] and losing all your preferences and caches...
Fifth:
Build ---> Build APK(s)
Sixthly:
File -> Settings -> Build, Execution, Deployment -> Instant Run -> Uncheck checkbox there
UPDATE:
1.Open the projects gradle.properties file in android studio
2.Added this line at end of file org.gradle.jvmargs=-Xmx1024m or org.gradle.jvmargs=-Xmx512m & Save the file
3.Close & reopen the project
after 3 days of searching and fustrating i have found the issue!
The problem was my SDK buildtools was on version 27.0.3 and now i have installed 28.0.1.
I think androidstudio Version 3.1.2-3.1.3 need compellingly SDK buildtool version 28 above

Project with path ':jtds-1.2.7' could not be found in project ':app'

I want to connect android app to SQL Server database. For this connection, i have tried to add up Jtds.jar file in Project library. After include this file when we click on sync now and Studio build the gradle and show this type of error.
Error:(25, 0) Project with path ':jtds-1.2.7' could not be found in project ':app'.
What's the actual problem? Anybody help me about fixation of this error
In my case, work after extract .zip file
CLEAN PROJECT AFTER CHANGES: build -> clean project
I think you get the Error Msg with Red color.
Don't worry this is the problem of .jar file path is not properly configure.
You fix this bug you must Follow the steps.
1). File>Project Structure> Click > app in a list
2). In center window on top have the tab Name Called Dependencies Click the Tab. In a list many lines will be listed as what is present in your Project have build.gradle(Module:app) file.
3). Go to right corner of the window Click + button.
4). Find jar Dependencies or File Dependencies Click.
5). The new window will appear on the screen and choose the location of .jar file in your project and click OK button.
6). Finally the Project will be Sync automatically when you click OK button.

Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules"

I am using Android studio 1.0.1. I have a java module referred by other modules in my project. I have checked it out from SVN But now every
Unsupported Modules Detected: Compilation is not supported for following modules: . Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
After getting this error AS stop compilation of this module so that I am not able to compile/run my project any more.
1- close the project
2- close Android Studio IDE
3- delete the .idea directory located inside the project folder
4- delete all .iml files
5- open Android Studio IDE and import the project
First of all you should update to Android Studio 1.2
Source: https://code.google.com/p/android/issues/detail?id=77983
Then you should go to File -> Invalidate Caches / Restart -> Invalidate Caches & Restart.
Then try to build the application again.
Invalidate Caches and Restart did not work for me. I also updated all my Android Studio files with no success.
The solution I found was importing the android folder by clicking "Import project (Eclipse ADT, Gradle, etc.)" rather than clicking "Open an existing Android Studio Project" or dragging the folder onto the app icon.
Apparently the problem is caused because a module in the project has an *.iml file that does not contain external.system.id="GRADLE".
When you import the project (as opposed to opening it), the iml files are completely re-written, thus removing the error.
I found the info here: https://issuetracker.google.com/issues/37008041
Goto .idea/modules.xml & delete the invalid/not existing path <module />. Then File => Invalidate Caches / Restart.
Try this if it helps File -> Invalidate Caches / Restart.
If it still doesn't help click on the button in the image.
'Sync Project with Gradle Files'
I know it's an old question. but I faced this problem after updating to Android Studio 3.0. I solved it by deleting app.iml file inside my app module and then Invalidate Caches / Restart.
In my case settings.gradle contained invalid configuration.
I changed:
include ':app'
rootProject.name='<somthing else>'
To:
include ':app'
Error is gone. So maybe check your settings.gradle for potential errors. If this won't work try to remove cache and other tips.
Delete .idea/modules.xml
Reload All Gradle Projects
You do not want to remove entire .idea directory, because it contains e.g. dictionaries and shelved changes.
If the above doesn't help you - check your module .iml file and see if it contains any errors. (for the app module it will be app.iml).
Invalidating caches/Restart didn't worked for me.
But simply deleting the caches folder in \Users\user.AndroidStudio(version)\system worked like a charm
You may resolve by below process:
In Android Studio, go to left panel, switch from Android to Project pane
Expand .idea folder, you can see modules.xml and open the file.
In the modules.xml file, you might see like below:
<component name="...">
<modules>
<module fileurl="file://$PROJECT_DIR$/[check...].iml" filepath="$PROJECT_DIR$/[check...].iml" group="myProject" />
<module fileurl="file://$PROJECT_DIR$/app/[check...]-app.iml" filepath="$PROJECT_DIR$/app/[check...]-app.iml" group="[check...]/app" />
Check that match the module name correctly in module element
And then, sync the gradle file
Close the Android Studio and Move ".idea" Folder and paste it outside Project root folder( For Back up if you need).
Open the Android studio.
On Opening the project it"ll ask add module (app) to your project. You can ignore the same.
It set set default build variant to be "debug".
You can see build variant tab on left corner or hover on "Monitor" Symbol on left bottom
Note: No need to change your .iml file of your project.tom to get build variant option and "Invalidate Cache and Restart" will also not work rather it will clear your history files too!.
I solved a similar problem by closing the project, then re-importing the project (not opening, but re-importing as an eclipse or other project)
Try the below,
Close android studio
Then delete .iml , .idea files
Open again the android studio
Sync with Gradle.
In My Case
I have deleted
android -> .idea Folder
android -> appname.iml file
android -> app -> app.iml file
Open project in Android Studio and no need to File -> Invalidate Caches/Restart
You can do Invalidate Caches / Restart for your case.
The above solution I've tried but didn't work for me.
I deleted the .idea folder from project directory.
Invalidate caches using Android Studio menu File -> Invalidate Caches / Restart
Deleted .gradle folder from user profile directory of Windows 10 operating system. (i.e., C:\Users\YourUserName\.gradle)
Try this solution if the above not working.
You should import the the project
https://issuetracker.google.com/issues/37008041
This error shows up when there is a module in your project whose .iml file does not contain:
external.system.id="GRADLE" Can you please check your .iml files? Also, instead of opening the project, import it, that will completely rewrite your .iml files and you won't see that error again.
Try this steps Individually:-
1) Go to File->Invalidate Caches / Restart.
2) Close android studio, Go to C:\Users\(Your UserName)\.AndroidStudio(version)\system and delete caches folder.
If till now nothing worked, then this step will definitely work...
3) Simply change project location and import project with new location.
Enjoy :-):-)
Step 1 : Delete .iml file
Step 2 : Check if your Project Directory Contain any white spaces if so then Rename your project directory leaving space
ex:
Before : My Project
After rename : MyProject
and open Android Studio...
For windows users, this can also be caused by filesystem corruption.
If all steps above do not correct the error:
Close Android Studio
Open Command Prompt as Administrator
Run a chkdsk /f on the drive your app is stored
Delete .idea folder
Restart Android Studio
save .idea folder somewhere else (for backup)
remove .idea folder
start AndroidStudio
select project
[there may be an error, ignore that]
click File -> Invalidate Caches/ Restart
click button: Invalidate Caches/ Restart
resolved
Delete .idea folder
Close project ->
Reopen Project ->
Invalidate Caches / restart
You can update new version of Android studio then go to invalidate catches/restart.Click sync button build application.
In my case I cloned a git-project where both Java and Kotlin included. Then checked another branch and pressed "Sync Project with Gradle Files". Android Studio 3.0.1.
I had the same issue on androidStudio 3.2 and clonning the project worked for me
In my case it is because the root project name have a space.
So instead of naming it as sample project, it should be sample-project or sample_project.
click File -> Invalidate Caches/ Restart doesn't help you anymore
Delete .iml , .idea files & folders from file explorer not inside android studio
1) Open android studio with different/another project
2) import project newly not from recent
3) build the project again
sure it will work
I had the exact same error and it was so annoying to see the alert every time I stared Android Studio. I tried the solution mentioned above including invalidating cache, restart etc, nothing made it go away.
In my case, we had a module that was deleted from source and the reference also removed from settings.gradle. Turns out, .idea/modules.xml was still referencing that module.
All I needed to do was remove that line from <modules> in .idea/modules.xml and it made it all go away.
I have the same issue. I was tried Invalidate Cache / Restart & also sync project with Gradle Files but still didn't work.
But worked by use the following steps:
upgrading gradle distribution version at gradle.wrapper.properties.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
And also Android Gradle Plugin at build.gradle project
classpath 'com.android.tools.build:gradle:4.1.2' //upgrade gradle plugin here
Then Invalidate Cache / Restart
That's all solved my problem. Hope you too
rename project directory fix error for me, android studio 3.4.2

Android Studio Gradle Already disposed Module

I have installed Android Studio version 1.0.1. I have imported my projects from eclipse and it works fine.
Then I deleted a module and reimported it into my Android Studio project. The gradle build says "BUILD SUCCESSFUL" but it pops up an alert window with the message
Failed to complete Gradle execution.
Cause:
Already disposed: Module: 'MYMODULENAME'
I can't start my app now. Any idea what I can do?
Edit:
I solved the problem with the following instructions:
Switch project view from Android to Project
Remove entry include 'MYMODULENAME' in settings.gradle
The blue box in the module symbol don't show. Then you can delete the module in the context menu
Import the module
Note: this is purely an IDEA/AS issue, gradlew clean | Build > Clean | Build > Rebuild will just waste your time.
Most of the solutions here are blind stabbings in the dark. Here's what I found to be the root cause:
Some of the .iml files may be missing (maybe because we deleted it),
check if the module erroring has .iml.
If it is missing, check if .idea/modules.xml has an entry for that module
While syncing I noticed that IDEA/AS tries to put a new duplicate entry into .idea/modules.xml while there's already one. This duplicate entry is probably disposed of twice while the sync tries to reset the modules in memory.
Quick Solution: In order to make it work the easiest is to delete .idea/modules.xml along with the .iml files. Additionally may worth deleting .idea/modules/ folder if it exists. Restart Android Studio (no need to clear cache) and force a Gradle sync from Gradle view or toolbar to recreate the files.
I figured out this problem by:
./gradlew clean
Restart Android Studio
Simplest solution. (Try this first).
Quit and Restart Android studio. (Quit not close)
Build > Clean your project if needed.
works for me:
File -> Invalidate Caches / Restart... -> Invalidate and Restart
Sometimes gradlew clean or Invalidate Cache and Restart does not help, because these methods do not clean Android Studio specific files by themselves.
In this case, close AS and remove .idea directory and .iml file in a root project where settings.gradle file exists. This will make AS rebuild from the fresh ground.
For me this happened when i deleted a module and built a new one with the same package name
Solution:
Clean & Restart Studio
In the left pane, change to "Project" view.
Delete MYMODULENAME.iml
For an alternative solution, check if you added your app to settings.gradle successfully
include ':app'
For me this happened when I removed a module and tried to build the project:
Simple solution was to Invalidate the cache & Restart.
Android Studio>File>Invalidate Caches>Invalidate & Restart
Had a similar issue when working with RN components in my Android project and the only way to get around this issue was to ignore the gradle project.
To do this:
Click on the gradle tab on the right hand side of AS
Right click the gradle module which is causing an issue
Click "Ignore Gradle Project"
Perform a gradle sync which should be successful now
If you need this module perform the 4 above steps again, this time when right click on the gradle project it'll show "Unignore Gradle Project"
Gradle sync should now work
No idea what causes this but I've had this happen to me when using React Native Maps.
Note: If you're still having issues following this. Try to refresh the gradle project which was causing issues.
If gradle clean and/or Build -> Clean Project didn't help try to re-open the project:
Close the project
Click "Open an existing Android Studio project" on the "Welcome to Android Studio" screen
Select gradle file to open
Warning Be aware it's a destructive operation - you're going to loose the project bookmarks, breakpoints and shelves
below solution works for me
Delete all .iml files
Rebuild project
For Solve this issue take it this simple steps.
Find the .idea folder in your Android studio under the Folder Project.
In .idea --> Find this one. .idea/.modules
Simple Delete that .modules folder and restart Your studio.
when it reopens gradle sync Automatically and also recreate .modules folder and files.
Error has gone !
I also face this problem sometimes. Click on gradle console in bottom bar of android studio, at right side. It will show the exact error in logs. My problem was that I had compile SDK 22 and imported appcomact library was of sdk 23.
I had the same problem,
after delete some gradle files (of aws)
i solved it by mark them "ignore gradle"
I believe it is not the best answer but it solve it for me
Gradle (at the right bar)--> right click on the problematic gradle --> ignore
Although the accepted answer didn't work for me (unfortunately I can't leave a comment), it led me in the right direction.
in .idea/libraries i found that there were some duplicate xml files (the duplicates were named with a 2 before the _aar.xml bit).
deleting those, restarting android studio and sync fixed the error
I was having this issue because gradle and Android Studio were using a different path for the jvm. In the Event Log there was an option for AS and gradle to use the same path. Selecting this and then doing an invalidate cache & restart resolved the issue for me.
In my case, same as in this question, it happened because I had my project in a symbolic link directory. After reopening the project in the real directory and reconfiguring gradle (File -> Sync with Gradle files) the problem went away. Shame on you, Android Studio!

Can't find "Sync Project with Gradle Files" button in IntelliJ IDEA

I just added the google-play-services-lib library to my project and am stuck where I need to "sync the project with gradle files", but this button does not exist on IntelliJ 13.0.1. Is there an alternative to this function?
As alternative you can use Refresh all Gradle projects button in Gradle tool window.
I also have not found this button so I made my own :)
Open Gradle tool window with View -> Tool Windows -> Gradle
Start Macro Recording with Edit -> Macros -> Start Recording Macro
In Gradle tool window press Refresh all Gradle projects button
Stop Macro Recording with Edit -> Macros -> Stop Recording Macro
Save Macro with name Gradle sync
Press with right mouse button on IntelliJ IDEA toolbar and choose Customize Menus and Toolbars...
Under Main menu -> Edit -> Macros -> Macro Actions find your Gradle sync Macro, select it and press Edit Action Icon...
Download this icon Sync Project With Gradle Files icon (from documentation http://developer.android.com/google/play-services/setup.html) and select this icon in IDEA dialog window
Now in Menus and Toolbars select last item in Main Toolbar group, press Add After... and select All actions -> Macros -> Gradle sync
Now you have Sync Project with Gradle Files button!
There is a useful shortcut Ctrl + Shift + A, after which a window appears and you can type some command that you would like IntelliJ to run. Just type "sync" in there and it will find that command Sync Project with Gradle Files, even if it's not visible in the menu.
"Sync Project with Gradle Files" is not present in IntelliJ. However a similar option is available to build all the gradle files together. Go to View --> Tool Windows --> Gradle. A Gradle task panel gets displayed in the right side with the list of apps. Select your app and click the "Refresh all Gradle projects" in the top bar of the Gradle task panel.
Another method is as mentioned by "Avi Arro"
The Gradle sync is still there, under Tools -> Android -> Sync with Gradle
If you don't see it, then Intellij needs to re-link your gradle file.
Try closing the project, re-opening by File -> Import Project -> and select your .gradle file
In my Case, One of My plugin, Android support got disabled due to some reason , As soon as I enabled it , and sync it the button automatically showed.
Go to File > Settings > Plugin > Android support(Tick this).
and sync your project.
I haven`t seen such option in pure IntelliJ. I guess you are developing some android app. You should then switch to Android Studio (based on IntelliJ) where this option is available for sure.
http://developer.android.com/sdk/installing/studio.html
Just in case someone who uses Android studio is experiencing this issue (can't find sync gradle feature), I'm posting my answer here. I'm new to Android, so I had no idea to fix this. What I did was I cleared the AS cache.
File > Invalidate Caches / Restart
Voila! The Gradle sync button is now there.

Categories

Resources