2

I installed Android Studio the other day to develop an app and even though it's not the first time I've used it, it's the first time I've installed it on this PC and I'm fairly new to all of it.

Problem: After installing Android Studio, I can't even make a "Hello_World" app, even the templates AS offers have a compiling error:

enter image description here Where it doesn't recognize symbols like "Override". The Alt+Enter solution that offers is to Setup JDK which does nothing for all options or create annotation 'Override' which doesn't really seem like a good option.

These are both build.gradle files: enter image description here

Things I've tried to fix it:

  1. Reinstall Android Studio Multiple Times
  2. Download JDK manually and change references.
  3. Check Enviromental Values on system (Add JAVA_HOME and heck Path to be correct). Pretty sure both java and JDK work since in cmd I can run java and javac.
  4. Obviously Build->Clean and File->Invalidate Cache + Restart
  5. android.enableAapt2=false on gradle.properties
  6. Trying to delete all java from my PC and reinstall bare minimum THEN install everything separatedly.
  7. Install all SDK plataforms until Android KitKat.

    • It's worth noticing that in the past I had a lot of problems getting java to run in only one place (mainly because I install software in an HDD and have OS on another SDD).
    • Also, while installing AS for the first time I got into a BSOD because of VT-x having shitty interaction with virtualization of anti-virus (that took me a while to figure out) so it stopped halfway. However I've reinstalled a bunch of times so I don't know how that could matter.

The problem is very similar to this one

I'm practically lost here. I've been trying to fix this for three days and I've looked into dozens of Stack-Overflow posts with similar problems, haven't found a solution. Any idea will be appreciated.

Thanks.

Datasetter
  • 121
  • 2
  • 8
  • i would have expected to see a build.gradle file, wonder is it anything to do with that? For me this in included in a 'Gradle Scripts' directory at the same level as my 'app' folder – Gary O' Donoghue Apr 28 '18 at 18:37
  • I've edited the post. Is that what you ask me? – Datasetter Apr 28 '18 at 18:44
  • is your Android SDK location path matching the SDK directories you downloaded (7. Install all SDK platforms until Android KitKat)? You can locate it under Tools--> Android--> SDK Manager – Red M Apr 28 '18 at 18:52
  • Yes I think so, it's the one by default when installing AS. Even though I do not have an Android option on Tools the SDK Manager shows me: C:\Users\usr\AppData\Local\Android\Sdk. Furthermore, I downloaded those plataforms using SDK Manager – Datasetter Apr 28 '18 at 18:57

3 Answers3

3

I repeated your error:

enter image description here

I made it by deleting Android SDK(not java SDK) in Android Studio: File-Settings-AndroidSDK Try to pick at least one and install It seems that your problem is related to Android SDK

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
artmmslv
  • 139
  • 3
  • 12
  • Thank you a lot. Is Android SDK related to Java SDK in any way? Where is it located or how is it installed (I assume automatically during AS installation). – Datasetter Apr 28 '18 at 20:58
0

Okay guys, I've finally figured it out, thanks to artmmslv. Android Studio's installer detected automatically - two versions of Android SDK which were corrupted (probably caused by BSOD messing up the installation).

I had to make sure to delete everything. Java SDK, Android SDK. Java JRE. Every data from Appdata or documents from Android Studio. Once the computer is clean from any traces of already installed plugins, modules, and whatnot, it should be able to set up perfectly fine paths.

Also, make sure to set up manually and correctly the Environmental Values of java (path edit and JAVA_HOME).

Thanks for the help.

The Amateur Coder
  • 789
  • 3
  • 11
  • 33
Datasetter
  • 121
  • 2
  • 8
  • 1
    You should mark the response that helped you solve your issue as the answer so anyone experiencing this issue can find the solution more easily and so people don't continue to post new answers unnecessarily. – Pepe Salad Oct 07 '21 at 07:04
0

I got a solution that was a problem for me.

(in Build.Gradle file) - It's the

Compile SDK version 32

//which was not the latest one,

I changed it from older (31) in old projects to (32) And clicked: sync now, it worked!!

Hope it helps:) Happy coding

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 16 '22 at 14:25