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.
Related
I am very new to KMM (Kotlin Multiplatform Mobile) and iOS development (including CocoaPods). I have come across the following build error in Android Studio.
Execution failed for task ':shared:podInstall'.
java.io.IOException: Cannot run program "pod" (in directory "/Users/.../AndroidStudioProjects/.../iosApp"): error=2, No such file or directory
The directory definitely exists and I seem to be able to manually run pod commands from within the directory. I am not sure but it seems like this problem came about when I updated the Kotlin plugin from 1.5.0 to 1.5.10. This problem occurred even when starting a completely new KMM project.
I thought it might have something to do with Android Studio not being able to find the pod command so I added it to the path but that didn't seem to do anything. Any help with this would be appreciated.
Check your Gradle JDK :
Android Studio > Preferences > Build, Execution, Deployment > Build Tools > Gradle
Then select Gradle JDK -> Embedded JDK
Maybe you must execute in command line :
./gradlew :shared:podInstall
Have you tried File > Invalidate Cache and Restart?
I had exactly same issue, but It got fixed after invalidate cache and restart.
I know this question has been asked before but I haven't been able to fix the issue. I am running Android Studio version 3.1.4. I am trying to run an app that I cloned from a Github repository. But even before I try to run it, I get this error:
my-app: sync failed
Cause: https://downloads.gradle.org/distributions-snapshots/gradle-4.4-20171031235950+0000-all.zip
How do I fix this error? Thanks in advance.
You can check and change the distribution url in the properties file $rootDir/gradle/wrapper/gradle-wrapper.properties. See property distributionUrl.
Value should be something as follows (update the gradle version depending on your Android Studio version)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
I've encountered a similar error when I tried importing the Sunshine project from the Udacity Android development course. I fixed the issue by downloading the mentioned zip file and extracted it to the C:\Users\<username>\.gradle\native folder.
Then in Gradle settings, use local Gradle distribution and set the Gradle home path to the downloaded gradle folder.
Check this video for more information
You can fix it by the following steps: (currently using Android 3.6.3)
This worked for me.
Exit android studio then make the below changes.
Go to C:\Users\UserName.android and rename the build-cache folder to build-cache.bak.
Go to C:\Users\UserName.AndroidStudio3.6\system and rename these folders:
caches to caches.bak
compiler to compiler.bak
compile-server to compile-server.bak
conversion to conversion.bak
external_build_system to external_build_system.bak
frameworks to frameworks.bak
gradle to gradle.bak
resource_folder_cache to resource_folder_cache.bak
Open the Android Studio and open your project again.
If the folder is not in the Android3.6 folder, move to the next step.
Find the Gradle version from the gradle-wrapper.properties file
Download the Gradle bin file from internet, then extract it.
File menu-->Settings-->Build & Tools-->Gradle-->Use Gradle from: From
drop down select a specified location and browse to the location
where you have saved the Gradle bin zip file. (Default settings is use from ;gradle-wrapper.properties' file)
4.File menu-->Invalidate caches and re-run
[Gradle properties file]
[Gradle settings]
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
I have an error everytime I switch from one branch to another in my project (so I have to do 'Invalidate cache and restart', it helps, but takes time and it's not normal to do it everytime):
Gradle project sync failed. Basic functionality will not work
properly.
It started after I updated gradle and Android Studio. Now in my 'Project Structure' -> 'Project' I have Gradle version 3.3 and Android Plugin Version 2.3.0. The same is in other my branch. Any advice what is wrong?
Make sure that both run in the same versions and try again.
Try these two tasks:
1)Go to File>>Other Settings>>Default Porject Structure. Check there
the jdk path. Make sure that you have 64_bit.Finally, after this
clean project and rebuild it.
2.Go to the directory \Users\user.gradle\caches\2.x. You will find the directories
scripts & scripts-remapped. Keep a backup of them and then delete
them from the directory.Retry gradle sync. It should work as it will
generated new cache files
Found the solution: just click Tools > Android > Sync Project with Gradle Files (did it in every branch). Everything is fine now. Thanks to this article: http://devdeeds.com/update-gradle-plugin-android-studio/
My solution is :
File -> Invalidate caches / Restart
Shutdown Android Studio
Rename/remove .gradle folder in the user home directory
Now try to import that project using another project
Gradle build success !!
Done.
Hope it helps.
Error: Failed to create parent directory 'C:\Users\user1\.gradle\caches\modules-2\files-2.1\org.sonatype.oss\oss-parent\9' when creating directory 'C:\Users\user1\.gradle\caches\modules-2\files-2.1\org.sonatype.oss\oss-parent\9\e5cdc4d23b86d79c436f16fed20853284e868f65'
When i am installing android studio i received an error "Error opening file for writing " relates to apache-9.pom file. I neglected and ignore that error now it is showing error project is not syncing and editing and debugging is not working.
Clean project
Rebuild project
Sync Gradle
if doesn't work try to check build tool
or - clean out the system caches:
On the main menu, choose File | Invalidate Caches/Restart. The Invalidate Caches message appears informing you that the caches will be invalidated and rebuilt on the next start. Use buttons in the dialog to invalidate caches, restart IntelliJ IDEA or both.
Gradle cache
Gradle cache locates at
On Windows: %USER_HOME%.gradle/caches On Mac/Unix: $HOME/.gradle/caches/ You can browse to these directory and manually delete it or run