Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Error:(37, 63) error: not an enclosing class: MainActivity
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.


What I have tried:

Error:(37, 63) error: not an enclosing class: MainActivity
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Posted
Updated 18-Apr-23 2:29am
Comments
Richard Deeming 18-Apr-23 8:21am    
An unexplained error message, without any of the code it relates to, is not a question.

Click the green "Improve question" link and update your question to include the relevant parts of your code, and an explanation of what you have tried and where you are stuck.

1 solution

We cannot help you based on that little information: I'd guess that (37, 63) refers to a line and column number in the source file but other than that all we can say is that the message comes when you try to use this outside an instance method or constructor. Since this refers teh the cunnect instance of a class, you can't use it outside them.

This may help: How to Write Code to Solve a Problem, A Beginner's Guide Part 2: Syntax Errors[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900