Error in build.gradle file in the terminal - android-studio

For some reason, I am getting an error under my build.gradle file in the side bar. there is no error in the actual code however. what could be causing this and will it affect my app if I want to pull from firestore?
I am using android studio 3.5error screenshot on Mac.

It's normal for that error to be there. Since you're not opening the project as an Android project, but rather as a Flutter project, the IDE tries to identify the build.gradle file on the android folder, even though it doesn't have to do so. You can see that this happens even with a new project if you open that file.
You can just ignore that.
The real errors, if present, will appear when you try to run or build your flutter application.

Related

Flutter not building app without error at all

My Flutter project was working just fine. I lost my Internet connection for a bit and when it came back I got a pop up talking about an Android Configuration found for the project, I clicked Add, then it started showing me two Device slots on the Upper tab where it shows what devices are connected.
Now if I need to run my app on my device, Flutter simply tries to run the project, then stops without any output in the Run Tab of Android Studio. This is really giving me a headache... I wish it gave an error or something. Someone please help me so i can resume development.
if you have not changed anything in the android directory the easiest thing to do is to delete it, then run in the terminal
flutter create .
if you have changed a lot of things in the android you can copy your changes and do the same or can go an revert the gradle configurations manually.

Installation freezes at "Unzipping Dart SDK" in android studio

Recently I had installed a flutter plugin in android studio. And when I chose to create a new project, it asked me for the flutter sdk. I chose "Install SDK". It froze at ""Unzipping Dart SDK".
I left it in this state for more than 3hrs, but there has been no response.
Please can any one help me to continue....
This may be a bug in flutter (that it doesn't report a useful error), there are quite a few reports like this one in the issue tracker.
You should try running flutter doctor from a command prompt, as this will perform the same job of downloading/extracting the Dart SDK but may be easier to troubleshoot.
From the issue linked above, it seems like a common issue is permissions - having it in a location like Program Files that non-Admins can't write to and therefore you need to run as Admin for it to work. A better fix would be to not put Flutter inside a protected path like C:\Program Files.
In my case (Windows 7) i found that the flutter sdk folder permission was set to be readonly, once i changed the folder permission... it works fine

Android Studio errors in files but project compiles and run

I have a problem. After I imported a project in Android Studio, in the activity java files it says "cannot resolve symbols" at certain lines, and they are with red, even though the project was fully valid before. The project has all necessary imports too, but some are with red too. The thing is that gradle build is working fine without errors and app launches in the emulator. I have tried invalidate cache and restart and sync gradle with project files. Do you have any ideas. ?
SOLUTION:
In build.gradle(Module: app) file, update the dependencies and sync.

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.

Android Studio: disabling "External build" to display error output create duplicate class errors

I am starting my migration from Eclipse to Android Studio, and start playing with new projects on Studio.
My test project was working fine till I got some errors messages.
I had to do some manipulation (https://stackoverflow.com/a/16876993/327402) to enable the error output to display, and found the issue that I fixed.
Unfortunately, after this "workaround" (Why the hell have I to make such things to see my errors?), I found that there was an error message that I cannot fix:
error: duplicate class: com.mypackage.name.BuildConfig
error: duplicate class: com.mypackage.name.R
I also noticed that I am not the only one to have this issue (see the comment in the SO answer I linked above)
First time, I was able to fix it by enabling "External build" again, but that happened again, because I needed to see the error output and everything is now broken, and I cannot find what happen.
With Eclipse, the R file was easy to find, in the gen folder, but with Android Studio, there are too many files, and I am a little bit lost.
Any idea/suggestion?
I've found a question like this that has some replies here:
Cannot resolve R.java, duplicate class
You can try this:
Delete the Build folder generated by Android Studio automatically
Also you can try to Rebuild project by clicking Build->Rebuild project after deleting build folder.
So, just to let you know...
A few minutes after I posted my question, Google released an update to Android Studio (0.1.5)
See link: https://plus.google.com/+AndroidDevelopers/posts/Y9vhvGaHCbh
Tor Norbye kindly answered my question in this community, and I am sharing here
So the workaround I quoted in the OP is no more mandatory.
Enabling again External build after upgrading Android Sudio let me see the real errors ( a library and some Gradle import that I fixed)
So, I consider the Android Studio upgrade as the best answer to this question...
Ok, I also have the same problem, and this is what worked for me.
I first unticked external build from compiler settings. Then when I compiled i get two errors related to R.java, duplicate class.
Then i delete the build folder manually from finder. Then rebuild it from android studio, but still same error.
Then I again go back to compiler preference and tick the external build setting, and it worked fine after that.
Looks like some bug.
apparently, or at least for me 0.1.5 has a bug and cannot run in external build
because of some path error you can read about here
https://code.google.com/p/android/issues/detail?id=56628
so i switched to internal building, and then i hit the double R symbol bug
after deleting the build path application is compiled without errors but the build folder is not fully rebuilt, I'm missing the R.java file which the internal builder does not make.
i've rebuilt it on the external builder on an unupdated version as a temp workaround while this issues is fixed.
btw if anyone knows how to tell internal gradle to rebuild the build folder please share.
I just had the same problem and found a way to solve it (You can do this with Android Studio open):
Go to you Android Studio projects folder located in c:\users[USERNAME]\AndroidStudioProjects
Locate your project folder and open it.
Delete the folder named build.
From here, enter your application name folder, where you can find another build folder among with libs and src folders and a file named build.gradle.
RENAME the build folder to build2 or something else.
Now in Android Studio go to Build->Rebuild Project.
And after the project was rebuilt, open again the folder where the build2 folder that you renamed is located.
Delete the new folder named build that was created.
Rename your build2 folder to build again.
Done.

Resources