Android studio 3.1.2 create new project gradle sync failed - android-studio

I use this Android studio import existing project all the time and everything goes well. Today ,I first create new project which support c++ ,and after every step to the final, I got the error.Picture like below:
I don't know what's wrong,because when I importing existing project ,this error haven't shown.
And the project structure panel like below:
When I check connection in "Http Proxy" ,it returns successful :

Delete the corrupt files
When Gradle files are not completely downloaded or corrupted by some other reason,we have to redownload the files. The easy way is to delete the old files in.
C:\Users\username.gradle\wrapper\dists
Then rebuild the project.
Then Android Studio will automatically download the new files from the system.

Related

How can I make Android studio "forget" old filepaths when I copy an old project? [duplicate]

This question already has answers here:
What should be in my .gitignore for an Android Studio project?
(31 answers)
Closed 3 years ago.
Scenario:
I'm working through the exercises in an Android programming book.
I finish "Chapter 10", so I "Close Project" and exit Android Studio, manually delete build/* and copy "chap10" to a new folder, "chap11".
I start Android Studio > Open Existing Project > chap11.
So far, so good. Everything looks fine.
I start editing a .java source file or .xml layout file in chap11 ... and Android Studio overwrites the old files in the old directory instead (?!?)
Q: What causes this behavior?
Q: What can I do to make Android Studio "forget" everything about the old "chap10", and use ONLY filepaths from the new "chap11" instead?
I'm using Android Studio 3.5, Build: Aug 8, 2019.
I found the answer here. After copying the directory, I delete all of the following (and let Android Studio recreate them on gradle build):
https://stackoverflow.com/a/24679853/421195
app/build/*
.gradle/*
.idea/*
*.iml
local.properties
I think almost everyone agrees about /build.
I got sick of constantly seeing messages about the various library.xml
files that Gradle creates or deletes in /.idea. The build.gradle will
run on the developers's local when they first check out the project,
so why do those XML files need to be versioned? Android Studio will
also generate the rest of /.idea when a developer creates a project
using Check out from Version Control, so why does anything in that
folder need to be versioned?
If the *.iml is versioned a new user will have to name the project
exactly the same as it was when committed. Since this is also a
generated file, why version it in the first place?
The local.properties files points to an absolute path on the file
system for the SDK, so it definitely shouldn't be versioned.

Android Studio and "error: cannot find symbol class"

I there:
I am working in the last version of Android Studio, and I have the next problem. I am generating code (.java classes), so my code is generated outside Android studio and copied into the folder of the project. When I try to run the code, it shows the following message
error: cannot find symbol class XXXXX
Where XXXXX is a class that exists (I tried with other classes and it happens the same). The class is well defined, its visible by Android Studio but it still fails.
The code is generated, so it is copied directly into the folder of the project and I think it is the problem.
What I tried to do: (according to other answers).
Rebuild the project.
Close and open Android studio.
File - Sync with file explorer.
File - Sync Project with Gradle Files.
File - Invalidate Cache Restart.
And those solutions do not work.
However, this works:
Create a class using Android studio and now I can generate the class and replace the file. Apparently, Android Studio (or Gradle) is unable to recognize a file created outside Android Studio.
What I can do?.
I need to create many classes so I can't create each file manually.
Is there are an internal database?.

Trying to convert projects that werent built using Gradle

I have tried to clone the following repository on GitHub using Android Studio, https://github.com/AlexKang/favr.git, but I have the error:
Before this I selected build project using Gradle and then accepted anything it wanted to install. I am having similar problems with, https://github.com/mb16/RemindEm.git, where I get that
Each time I selected "create project from existing sources" and then accepted everything it suggested.
What am I doing wrong?
The projects have eclipse .classpath files in the folder. I'm guessing you should be able to import the project into eclipse.
As an alternative to using Eclipse you might want to try using a feature of IntelliJ IDEA (Android Studio's parent project). File > New > Project from Existing Sources... Then select the .project file for the import

Android Studio : Unable to add a new class or any file to a project

My Android was working perfectly and was able to add a new xml,activity or any new file to my project. Until recently, it gives an error whenever I add a new class or any new file. It always says:
Unable to parse template "Class" Error message: Cannot modify a
read-only directory
'C:\Users\jay\Desktop\CurLoc\app\src\main\java\com\example\jay\curloc'.
I already tried to change the attribute of the folder where my project is located by unchecking Read-Only box in the Properties. I also restart my computer and Android Studio over and over again and refresh the project but nothing works. Please help.
After spending countless hours trying to solve the problem I uninstalled Android Studio and installed it again, this solved the problem. I think it's a bug in Android Studio

Error after updating Android Studio

I have updated my Android Studio to 1.2.1.1 and now i am trying to create a new project and it shows an error:
"Error Loading Default Project "
Fatal error initializing 'com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager'
Please suggest a solution. Thanks in advance
Experienced the same problem on Ubuntu/Linux.
In my case the solution was to change the save path of my project from relative, to absolute.
Trying to create a new project in ~/AndroidStudioProjects/MyApp would generate this error
But if I specified the full path /home/myusername/AndroidStudioProjects/MyApp, the problem was resolved.
You have to reset Android Studio and this is a configuration problem.
Uninstall android studio and install again.
This link will help you with all steps of reinstall.
Unable to create new android studio project?
I just came across the same error:
'com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager'
Make sure that you have permissions to write to the project path.
android studio stores the project in the last location you loaded from and in my case it was a Flash Drive...
#Garima Mathur's answer suggests that is a 'configuration problem'
If it's a 'configuration problem' you can delete(*or better rename) the configuration folder.
which is located in the c:\users\CURRENT_USER\.AndroidStudio1.2
but in my case the solution was to change the path of the project to be saved.
I had the same error of "Error Loading Default Project"
Fatal error initializing
'com.intellij.openapi.vcs.changes.shelf.ShelveChangesManager'
and I figured out where the error was coming from. Previous I was running my project from a USB key labeled volume F. Later when I opened Android studio after unplugging, the default storage path was still F. Make sure your path is okay.
I also had the same problem. Following process worked fine for me:
Open your any old project in android studio.
Go to File > New > New Project.
Set Name to your Application.
At bottom of window there is "Project Location TextField".
Just change the Location Path to the desired folder and click Next Button.
I had the same issues, I tried to figure it by my self and it worked.
Try this, open your old project, then in your old project window, go to file > new > new project, and it will show the new project window to let you setup your project, after you finish your project setup, click finish and your project will start building and it will bring you to your new project window.
That's all, it works for me.

Resources