Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Android, "cannot find symbol" error for my own class

$
0
0

Hi,

 

I've been using the latest (I think 12.1) version of Intellij IDEA for Android development for about a month now and I've just come across a large issue. I'm getting a "cannot find symbol" error on one of my activity classes called "MainActivity". I've been doing a lot of research and haven't found a suitable solution so far.

 

What I understand is that the compiler can't find the symbol because the ".class" files that are supposed to be generated are not present and can therefore not be found. I noticed that the ".class" files for my "MainActivity.java" file were deleted after I had tried to change up the libraries used by the project. I added a library containing all of the ".jar" files that I needed and added that library in the "Modules" screen under "Project Settings" which is reached by first going to "Project Structure" like so:

 

Project Structure | Project Settings | Modules

 

So, when I updated the modules with the new library I found by looking at a "git status" command that all of my "MainActivity$InnerClassName.class" files were gone and thus couldn't be used to compile and run the project. I've tried removing and adding in the "MainActivity.java" file, rebuilding the project (which gets hung up on the same error as a regular compile and run), I've tried every configuration of "Project SDK" and "Module SDK" I can think of and I'm at a complete loss. Is there a way to get Intellij to generate the necessary ".class" files?

 

Any help with this would be amazing! I've also tried to revert back to a usable version of my code with Git but I need to make changes to the libraries and changing them makes things crash. Please let me know what other information I need to give to help get this fixed. I left out actual code snippets as the info is sensitive but I could post code if necessary, I'll just have to make some changes.

 

Thanks,

jdawes

 

Here is the error:

 

java: /Users/path/to/project/SplashScreenActivity.java:22: cannot find symbol

symbol: class MainActivity

 

Here is the output of a "git status" command:

 

deleted:    out/production/project/path/MainActivity$SectionsPagerAdapter.class

deleted:    out/production/project/path/MainActivity$CustomFragment$1.class

deleted:    out/production/project/path/MainActivity$CustomFragment.class

deleted:    out/production/project/path/MainActivity$CustomListFragment.class

deleted:    out/production/project/path/MainActivity$CustomAdapter $1$1.class

deleted:    out/production/project/path/MainActivity$CustomAdapter $1.class

deleted:    out/production/project/path/MainActivity$CustomAdapter $WorldHolder.class

deleted:    out/production/project/path/MainActivity$CustomAdapter.class

deleted:    out/production/project/path/MainActivity.class


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>