After update android studio - fail to create new project - android

After updating my Android studio today I created simple project and I got following error that.
Error:Could not set process working directory to 'E:\DevelopAndroid\myNewProject': could not set current directory (errno 5)
The 'E:\DevelopAndroid\' is exist and the 'myNewProject' folder created.
But still I can't upload the code to my Git server.
I am not able debug it.
And I don't know what to do.

Renaming directory without space
delete .idea folder
Restart Android Studio
It will work

close current project, delete it and create a new same project, it works for me.

under your project-> look a folder(.idea) delete everything in it. then go to file-> select sync project with gradle files click and let your project sync again

I solve this by assigning full control permissions to the root directory in my Windows 10 machine. In my case cdm-webservice-v2 is the project directory.

Related

Android; Type com.google.gson.ExclusionStrategy is defined multiple times:

after importing a project library i get the error
C:\Users\Jordy\AndroidStudioProjects\Application\app\build\intermediates\external_libs_dex\debug\out\classes.dex
any ideas how to fix this?
So i just had this problem again, i did solve it this time.
open your android project in explorer, delete the .gradle folder
then go to the app folder and delete the buildfolder in there.
re-run your project in android studio and it should be fixed

Gradle sync failed access is denied in android studio

Can someone please explain to me what this error is and how to resolve this error?
Gradle sync failed: D:\SoundsandPictures.gradle\4.4\fileHashes\fileHashes.lock (Access is denied)
Note: My project was on D: drive and i accidently deleted all my data on the drive and recovered it using a recovery software and getting this error while opening the project in android studio.
Goto File -> Invalidate caches / Restart
Shutdown Android Studio
Rename/remove .gradle folder in the user home directory
Restart Android Studio (It will download gradle metadata and data)
Gradle build succeed
Rebuild project. Done.
EDIT
Try this for Mac OS
Go to SDK manager (with Administrator rights), scroll down till the end, download "Android Support Library".
And it works (don't forget Administrator rights).
Reference this SO Question..
If do you have an antivirus software, try to check if it has blocked Android Studio.
In my case, I hid the .gradle file. On unhiding the file, it was fine.
Very late answer, but
I was getting the error "caches\5.1.1\file-changes\last-build.bin (Access is denied)",
deleting that file and re-building the project worked for me.
/.gradle/4.6/fileChanges/last-build.bin%20(Access%20is%20denied)
I resolved this issue by deleting .gradle folder and then restart android studio
clean and rebuild
i deleted the file, then appear another message but with other file, i did the same 3 times, and then a clean and rebuild and worked.
PS: those files regenerate after the build, so no problem there.
Same error was showing while doing in vs code. I solved just by deleting this .gradle\caches\6.1.1\file-changes\last-build.bin file. After relaunching the vscode the problem wa
make files not hidden (unchiek hidden in windows)
it means that you have no right to access that file, in my case it was on *.jar files at c:\gradle subfolders so I solve it by cmd:
C:\icacls "[PathToYourDeniedFilesOrFolderLikeC:\gradle]" /grant [YourWindowsUserNameHereLikeUser]:(OI)(CI)F /T
if it did not work you can right click on that file go to security tab then add yourself to get full permission on it. Good Luck Coding . . .
Hope this Helps ^_^
OK.. To solve this issue, simple navigate to your project folder like C:\Users\AndroidStudioProjects\Project.gradle\taskArtifacts folder and delete the file. The fileHashes.lock is holding a global lock and is preventing you from running your script. Deleting the folder would create the file again and your project will get built. Also there is a possibility that there are other locked files. Simply delete everything within the C:\Users\Administrator.gradle\caches folder.
Create a new Android project and move all your recovered files into it. This issue you are facing is because of existing settings in the old project.
Then ...
Go to File--> Project Structure --> Check Use Embedded JDK (Recommended)
whenever this happens
JUST DEL (MAKE A BACKUP 1ST) THE CULPRIT FILE (THE FILE RIGHT BEFORE THE MSG "ACCESS IS DENIED"
hope this helps

"AndroidManifest.xml doesn't exist or has incorrect root tag" Error

I am new to AndroidStudio AND Gradle.
I imported a project from eclipse, created a module, and tried to run the project, but I got this error:
AndroidManifest.xml doesn't exist or has incorrect root tag
I have been looking at this previous solution for it:
How to build an android library with Android Studio and gradle?
But that solution is WAY too advanced for me.
Could someone please help me understand in simpler terms what is going wrong and how I can fix it?
Thank you!
Update after one of the answers:
These are the options I have under the build menu:
clicking on Sync project with Gradle files button will solve your problem.
That button is under File section on Android Studio 3.6.1
Close your Android Studio
Goto C:\Users\user\.AndroidStudioX.X\system and DELETE the cache
folder
Launch the Android Studio
Goto Build (menu) -> Clean Project when done click the
Build (menu) again and click rebuild project.
That should solve the problem.
For me the issue went away once I opened the android folder of the project in Android Studio to run the project.
So basically, because I was trying to run the Android project from the Root folder, it gave me the error. We need to run the project by selecting the android folder of the project only.
Hope this helps someone!
Click on File > Invalidate Cache/Restart, and that's it. Your project should start working.
For me clicking on Sync project with Gradle files button did not solve the problem alone.
After Syncing project with Gradle files, I explicitly had to invalidate the cache and restart studio. Only after this action, the red cross-mark over configuration disappeared and everything started working.
In my case, my android project got corrupted and some of the files were showing characters, binary numbers, etc. I tried the following solutions
Invalidate & Restart
Rebuild Project
Sync with Gradle File
But none of the above solutions worked for me.
Then I just deleted the cache folder under C:\Users\username\.AndroidStudio3.6\system
and all the invalid characters disappeared and the actual contents of all the files were displayed. This solution worked for me.
Every Android project needs a file called AndroidManifest.xml to tell Android about itself. Either your project doesn't have one, or it's not in the place that Android Studio expects it to be. Try to find it, and move it to the root folder of the project.
1.Check whether the manifest file is there or not.
2.If it is there, check whether the package name is correct or not..
3.If you project has small number of classes, then you create new project in android and then copy paste your code from eclipse. It will be simple. But it is recommended only for small project.
And finally click 'Sync' in the Gradle file. Followed by Rebuilding the project will do a trick.
In my case the Manifest file seemed to be corrupted or maybe its meta data. Trying to open it in Android Studio will show some characters that you see when opening a binary file with a text editor, for ex. Anyway, my project is under Git, so I just deleted it and restored it back, problem fixed.
Go to C drive click User then select your android studio folder then select System find Cache folder and delete this folder before doing this close your android Studio.It will surely work.
I also had this problem, things I tried:
I delete user->gradle-> delete cache folder
Android studio-> file-> Invalid cache/restart
Using my problem is get resolved
I also had this problem, things I tried:
Syncing the file with gradle
Invalidate/Restart
But the problem was still there in the manifest folder-> manifest.xml file it had only 1 line.
So I went to User-> your_username -> Android Studio v -> caches and Deleted the cache folder.
Started Android Studio, and my problem was gone.
But I am not sure which of these might solve yours.
I have opened AndroidManifest.xml in file editor. Add some letters, save it, then android studio found AndroidManifest.
After this I can build project successfully
if your AndroidManifest.xml looks wierd than you can try checking local history or git history. by doing that you can copy paste the previous version AndroidManifest.xml
Experienced that too, there is a line on your manifest code that's incorrect, simply go through it and make necessary corrections.

android studio gradle refresh failed (The system cannot find the file specified)

Error:Could not open initscript class cache for initialization script
'C:\Users\Subash\AppData\Local\Temp\asLocalRepo2.gradle'
(C:\Users\Subash.gradle\caches\2.2.1\scripts\asLocalRepo2_cd0g6mnzdabuvxgeqlhhrxv0q\InitScript\initscript).
java.io.FileNotFoundException:
C:\Users\Subash.gradle\caches\2.2.1\scripts\asLocalRepo2_cd0g6mnzdabuvxgeqlhhrxv0q\InitScript\initscript\cache.properties
(The system cannot find the file specified)
UPDATE:
Check my answer here for full details
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.4\
2-Copy the folder "scripts" and paste it somewhere safe just in case anything went wrong you will place it back
3-Delete this folder "scripts" from the directory C:\Users\user.gradle\caches\2.4\
4- Sync Project with Gradle Files and you are done.
When you sync your project Android Studio will generate new cash files.
It worked for me I hope it will work for you...
I don't know why a great developer as Google can't manage this issue by them selves it is very easy to delete the cached folder and regenerate it programmatically. Any way just navigate to C:\Users\user.gradle\caches\ and open the latest version folder, then delete the scripts folder. Go to android studio and sync project, that should do it.
Exit Android Studio, remove the Gradle cache folder which path is in the error message, and restart.
You could try to delete this : C:\Users_USER_.gradle\caches_GRADLE_\scripts_XXX_\InitScript\initscript\cache.properties.lock
I had the same problem and after deleting it all works fine.
Another common problem with Gradle is synchronization which is solved adding the correct path of JDK but this is another story.
I hope to help.

Installing Android Studio issue with .gradle file

I just install android studio on a VM machine (VM Fusion). When I try to create a new project, I get the message "org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'."
I followed the suggestion found in the page.
Download Gradle directly from
http://services.gradle.org/distributions/gradle-1.6-bin.zip
Copy the contents of gradle-1.6 to
\Android\android-studio\plugins\gradle
Copy gradle.jar to \Android\android-studio\lib\
Restart Android Studio
It did not work. I get the error message
I tried to copy the zip package /gradle-1.6-bin.zip to the following location
C:\Documents and Settings\myusername.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\
the .gradle file was not there. I look in setting and notice that it under \vmware-host\sharefolders. I went there and the file was still not there. I unhide hidden file and folder with no luck.
In addition, when I create a new project, I notice the project location is \vmware-host\Shared Folders\AndroidStudioProjects\MyApplicationProject.
How can I get a new .gradle file or tell android studio to look at a different folder? How do I change the project location so it does not default to \vmware-host but instead to c:\development.
Any kind of help would be greatly appreciated.
Thanks,
JF
Copying Gradle inside Studio will not help. Just install it somewhere else and after manually creating a project you can import it in Studio and select which installation of Gradle to use.
You have to create the project manually, because right now creating a project from studio always use the wrapper that automatically download gradle from the online repository.
We are working on having an offline mode for project creation, but it's not available yet.
Just edit your System's DNS settings, and redirect services.gradle.com to 127.0.0.1 then use a small web server and serve the file under its appropriate directory (distributions)
As you said,"Copy the contents of gradle-1.6 to \Android\android-studio\plugins\gradle",this folder under the setup path.
Why did you copy it to "Documents and Settings"?

Categories

Resources