The specified project directory ''" does not exist - android

Ever since I have upgraded my Android Studio 3.0.1 to 3.1 I am not able to run the project.
Executing task 'assemble'..
FAILURE: Build failed with an exception.
* What went wrong:
The specified project directory '' does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 0s
The specified project directory '' does not exist.
15:52:35: Task execution finished 'assemble'.

If you are using IntelliJ with Gradle, you may need to unlink a non-existent module in the Gradle tab.

The issue might also be caused by an empty 'Gradle project:' field under:
'Run'
-> 'Edit Configurations...'
-> 'Gradle'
-> 'NAME OF YOUR CONFIGURATION'
-> 'Configuration'
-> 'Gradle project:'
Filling out this field by selecting the root directory of my application (an clicking on 'Apply') resolved the issue for me.

Delete .idea and .gradle folders and try to re-import the project. I had refactored my project name and I ran into the issue and deleting .idea and .gradle folders and re importing worked as it clears the meta data of project configuration for intellij or android studio.

Navigate to "File" and select "Invalidate Caches and Restart" from the drop down. After Android Studio restarts, your project should run.

have same issue
I copy an already existing project and try to run it and got this error
I fix it by
Enter to the settings.gradle file and change the "rootProject.name" to my new project name
If this not the issue than
2) from left side press on Gradle
press on project that failed to build and remove it
maybe you will need to restart the intelij after

Related

Can't build my android project after move it to another computer

I can't build my android project in react native project, i just used this project in my old computer and it built fine, but after i clone it from my new macbook i get error.
I tried to delete the cache folder and it didn't help.
The error that i get:
FAILURE: Build failed with an exception.
What went wrong:
Could not open settings remapped class cache for espedq8f7vbnwrshulq11juyl (/Users/(UserName)/.gradle/caches/5.0/scripts-remapped/settings_3tlaqtt0fziq08p73u9gmyutn/espedq8f7vbnwrshulq11juyl/settingsa9190c3ddc71e1450eb3f3e7bc6a334f).
Could not open settings generic class cache for settings file '/Users/(UserName)/Desktop/MyApp/friendsapp/client/android/settings.gradl' (/Users/(UserName)/.gradle/caches/5.0/scripts/espedq8f7vbnwrshulq11juyl/settings/settingsa9190c3ddc71e1450eb3f3e7bc6a334f).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 57
Yes i found the answer!
I just clicked in android studio, FILE -> sync project with gradle files .
It did the magic !
Edit
Help me so many times for building:
yarn add jetifier
yarn run jetify
rebuild project in android studio
To clear Android Studio's cache and bring it out of its state of confusion, select 'File > Invalidate Caches / Restart' and then click the 'Invalidate and Restart' button.
You should invalidate caches from android studio not deleting cache folder directly.

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'

various things result in this error, so I thought an answer to point this out would be useful, because the existing answers for this error were not helpful in my case
problem
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
how to diagnose (in android studio 3.2.1)
click on Build tab on bottom toolbar
click on Build tab (next to Sync tab) at the top of the panel that appears
you will see this:
* What went wrong:
A problem occurred configuring project ':app'.
> More details/hints about your problem here.
also add compile flags: go to File->Settings... -> Build,Execution,Deployment -> Compiler -> Command-line Options: --stacktrace --info
click apply, ok
how to fix
in my case, it could not find the ndk, so I defined the environment variables
ANDROID_NDK
ANDROID_NDK_HOME
ANDROID_NDK_ROOT
all pointing to
d:\android\android-ndk-r18b
(the root of the ndk where it unzipped)
then, restart android studio (to see the new environment variables)
reload the project
File->Project Structure
set Android NDK location to same path as above, click OK
File->Sync Project with Gradle Files (or click Sync Project with Gradle Files icon in top toolbar)
now build and run work
if run is not available, need to Edit Configurations... in the dropdown next to the build hammer in android studio;
do another sync as shown above, then build and run work

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

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.

cannot find symbol class R android studio 3.0.1

cannot find symbol class R
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
I think the project xml design contains any error. in that case R file could not be created. So please verify the xml file if no such error found then rebuild the project using Build → Clean Project / Rebuild Project
Check if there are any errors in your build.gradle (Module: app) file, and then sync it by using the refresh button from the Gradle panel.
Build > Clean Project, and then Build > Rebuild Project
I have been using MacBook Pro for my Android development, but I don't shut down but use the sleep mode normally. Because of this, my Android Studio gets out of control occasionally. Therefore, by simply restarting your entire development PC might resolve your issue.
Alternatively, you can try File > Invalidate Caches/Restart to clean up all the related caches.
Make sure that you have imported import <package_name>.R; (you can use Alt + Enter), than clean and rebuild your project (Build → Clean Project / Rebuild Project)
Note: Sometimes importing R file could not resolve the issue

Gradle build not executing because it can't find cache.properties

My gradle build in android Studio is failing because it can't access the cache.properties file. I have tried invalidating all caches and retrying but that did not work. I also reinstalled all the SDK tools. Here is the error I'm getting
Error:java.io.FileNotFoundException: C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
Blockquote
Any advice on what to do, here is the complete console output:
FAILURE: Build failed with an exception.
* What went wrong:
java.io.FileNotFoundException: C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
C:\Users\Siddharth\AndroidStudioProjects\IntentAssignment.gradle\2.4\taskArtifacts\cache.properties (The system cannot find the file specified)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.747 secs
delete gradle folder, quit Android Studio and Start again fixed this problem for me
run cmd
write %temp%
then temp folder open delete all file in temp then rebuild your project
hope this will solve your problem
After Search i found this answer and worked for me
thanks to #Salam El-Banna and #Naveed Ahmad
You don't have to delete all .gradle folders and no need to reinstall Android Studio.
I have the latest version of Android Studio and I faced that problem, the only thing that worked for me is to:
1- Navigate to
C:\Users\user.gradle\caches\2.x\
2- Copy the folder scripts , scripts-remapped and paste it somewhere safe just in case anything went wrong you will place it back
3- Delete this folder scripts and scripts-remapped from the directory C:\Users\user.gradle\caches\2.x\
4- Sync Project with Gradle Files and you are done.
When you sync your project Android Studio will generate new cache files.
It worked for me I hope it will work for you.
reference:
Cache.properties (The system cannot find the file specified)
Delete your Gradle folder
Invalidate cache and Restart
Simply these steps fix your issue.

Categories

Resources