I've faced a problem during the installation process of the android studio. I've ignored the failure at the start and after creating a project,it stated that "Gradle sync failed: Failed to create parent directory".
I've downloaded most SDK and searched for possible answers online but I'm still not able to solve the problems.
Please provide me with all the help possible. Thank you
In my case, I have pulled my repository, and it was displaying this error. To fix, just run the commands:
flutter clean
and then:
flutter run
It is because android studio needs admin privilege to create directory in that path.
So, to solve this problem simply run android studio as administrator
Look at the location its failing to create, go to that location and delete cache folder, worked for me
deleting the build folder in the android/app directory fix my problem
I run chown -R user:user /path/to/.gradle.
I found some of the directories had been owned by root. Maybe its because, during software update, i was forced to run Android Studio or IntelliJ IDEA as root due to installing them under /usr/local
If you are building project on same computer just run flutter clean and then invalidate caches and restart project.
else delete build folder from project directory.
delete the build folder in the android/app
Related
I've been looking and googling for a while and couldn't find a fitting answer, I've tried different commands through the terminal, as was suggested in some forums but nothing really helped.
I have this issue for some reason only with a specific project, other flutter projects that I have are running with no issues at all
For Example, I've tried to run this in the terminal and this is what I got:
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project
Any help, suggestions, and recommendations would be much appreciated
This problem is due to the fact that you are running the flutter run command from a different directory. Usually, when you try this command, you are in the parent directory instead of the root directory.
Try running the flutter run command from the project directory using the cd YOUR_ROOT_DIRECTORY command you can enter to that directory.
decided to reinstall android studio and make sure that everything is correct with the PATH of the SDK, and reinstalled the SDK tools.
pretty much worked for some reason
I checked out a git repository in android studio, but I'm in trouble with Gradle sync failed error.
When project wants to build, the android studio raise an error like as following:
Gradle sync failed: Could not create parent directory for lock file
C:\Users\username\.gradle\wrapper\dists \gradle-4.10.1-
all\455itskqi2qtf0v2sja68alqd\gradle-4.10.1-all.zip.lck
I saw some answers to the other almost same problems, but none of
them help.
Also I deleted cashes in .gradle directory according above path, but it does not work.
How can I solve this problem?
I appreciate you to solve this problem, thanks.
I found this answer:
In the upper-right corner of android studio click on the Gradle tool,
then right click on the your project name then click on the Refresh Gradle project as following:
Then click on the Build -> Rebuild Project as following:
Run this following command:
gradlew clean
gradlew assembleDebug
If this does not work use following command.
gradlew --update-locks assembleDebug
Remove C:\Users\yourname.gradle
then close android studio
and Start Android Studio with administrative permission.
it fixed in my case.
For anyone who still encountering this issue, I have just ran the Android Studio as administrator and it worked.
I have a problem with Gradle building. When I build my project, it displays the error:
Finish can only be called once in android studio
Anyone have idea about this error?
in android studios go to ....
file > invalidate caches and restart ....click invalidate and restart button in confirmation dialog..
might take few time to build Gradle..
I was able to resolve this issue by stopping the currently running gradle daemon so from command line:
./gradlew --stop
Or if you're using android studio: Restart android studio.
I've cleared the cache in advance but it didn't work.
Close Android Sudio, on your Home directory (on windows : C:\Users\YourUserName) enter .gradle directory and erase caches directory, then restart Android Studio and the error should be solved.
on windows : C:\Users\YourUserName) enter .gradle directory and erase caches directory
if you run Android Studio as root, then run gradle commands as root too, try sudo ./gradlew assembleDebug or sudo ./gradlew assembleRelease
There are many sophisticated answers. But for me none of this helped, only reboot.
A simple restart of android studio works.
People, if you are using Android Studio in mac, by default you will be getting a BUILD file added in your project.Not sure whether it is bug or might be added default to all Android Studio Projects. Make sure to delete
BUILD file and then restart Android Studio. If you see the same error "Error: Finish can only be called once" again then restart your computer.As i faced this issue many times, this solutions worked for me.
error "Finish: only can be called once"
Gradle cache problem: The default amount of cache path in:
on windows: C: \ Users \ YourUserName)
1, exit the studio
2, enter the cache path, find C: \ Users \ Administrator . Gradle
3, delete the caches folder or delete. gradle folder
4, restart studio to rebuild;
recreate andoid studio configuration.
close problem project.
remove .iml files and .gradle .idea directories.
open project.
Android Studio (v2.2 Preview 3) suddenly failed to update the tools. It keeps giving the error pasted below:
To install:
- LLDB 2.2 (lldb;2.2)
Preparing "Install LLDB 2.2".
Failed to read or create install properties file.
Failed packages:
- LLDB 2.2 (lldb;2.2)
I gave the folder full permissions. Ran android studio on administrator mode. End-tasked adb from task manager. Disabled antivirus. Deleted the folder and then ran the update again. But nothing works.
I also tried to create a new sdk location on my drive. But then that failed to, it gave the same error as above. -> Failed to read or create install properties file.
Any ideas?
I also encountered the same error when trying to update build tools after upgrading Android Studio. Unfortunately, in my case, removing .AndroidStudio2.x folder and re-opened studio with no config imported didn't work.
But then inspired by this answer, I go to Android Studio folder, then to bin folder, right-clicked on studio64.exe, choose Run as administrator. Then when I tried to update the build tools, it worked.
I'll just leave it here as an alternative way in case someone encountered the same problem.
For some reasons, this happens when you import the settings when upgrading Android Studio.
The fix is to delete the .AndroidStudio2.1 or .AndroidStudio2.2 folder in your profile directory. Open android studio and don't import any config.
This will however will ask to download the supporting libraries again.
In Windows 10, I pinned the application to my taskbar, and right-clicked on the icon and chose the option to run as administrator. Then I went through the steps to download my SDKs. Everything worked as it should.
Using Windows7: I unzipped the SDK under C:\Program Files\... but eventually discovered that security permissions in the "Program Files" area prevented sdkmanager.bat from creating folders and files.
It looks like you can give sdkmanager.bat permissions, but there are many complications, especially in cmd.
So I moved the SDK to C:\Users\[admin_name]\.android (or any folder) where it's easy for the sdkmanger to create folders and files and it finally worked !!
Hope this helps someone. Thank-you to all those who have helped me.
When using the sdkmanager command in Linux, you have to run it as root:
sudo sdkmanager --install emulator
On Linux, It's a permission issue. You can resolve the problem quickly by launching Android Studio as root :
gksudo <path_to_file_studio.sh>
If you want to fix this problem on long term and in more secure and better way you should find the right files / folder to alter and change their permissions. I didn't point it for now.
This solution was tested on Debian, but I guess it works on Unbuntu, Mint ...etc.
You cannot edit local.properties it is a generated file, right click your project and select 'Open Module Settings' under SDK Location put your location for your SDK.
paste in /Users/gururaj/Library/Android/sdk
Clean and rebuild your project
Update
Try to delete your local.properties file and create a new one, but do not check it into version control.
Right click top level of project and Create new file 'local.properties' then add: sdk.dir=/Users/gururaj/Library/Android/sdk
Clean and build
It worked for me to uninstall everything, delete the directories created in Program Files and Program Files (x86) and reinstall in another directory.
Without any changes in my code, suddenly i get this error when I try to run my app:
What went wrong:
Execution failed for task ':app:packageDebug'.
com.android.builder.packaging.PackagerException: java.io.IOException: Failed to read zip file 'C:\Users\Eliran\AndroidStudioProjects\Forum\app\build\outputs\apk\app-debug.apk'.
I have no idea why its trying to read the apk as zip file.
If I restart Android Studio, I can run the app once and then It happens again.
For me it helps (for now) when I Exit Android Studio, next I used Windows Task Manager (Ctrl + Shift + Esc) and kill process Java(TM) Platform SE binary and delete that file manually. After that I run Android Studio again, click on the Clean Project (there can be an error with app:clean, but you can run Android Studio again) and next click Make Project - after that of course Run 'app' button in Android Studio.
This issue has been reported to the development team: https://code.google.com/p/android/issues/detail?id=210693&thanks=210693&ts=1463824240
Its solve my problem perfectly. i Just delete my build file and file>> Invalidate and restart android studio. This problem occur for me change dependency version
I try manual delete file, but the SO inform: the file "app-debug.apk" is in use by "OpenJDK Platform Binary". Then I kill "OpenJDK Platform Binary" and this worked.
If you are using flutter, type
flutter clean
and restart your ide. It worked for me.
After wasting my 4 hours i could fix this.
I fixed it by deleting ~/.android/debug.keystore file.
1.delete debug.keystore file
C:\Users\xxx\.android\debug.keystore
flutter clean
restart ide
just delete debug.keystore file under .android