Cannot resolve Symbol R, where is gen folder in Android Studio?

后端 未结 6 766
傲寒
傲寒 2021-01-12 05:58

I have created a dummy Android project from within Android studio, and I can make it run, but the Editor itself fails to find the R class. In fact I can\'t find the gen fold

相关标签:
6条回答
  • 2021-01-12 06:35

    @joe_deniable gave me the idea to look closer in the build folder, and I found a folder that had been excluded by intellij, where my R was happily having an ice cream. This was here:

    build/source/aidl/debug

    I had to remove this folder from the exclusion list and add it to the sources, and could finally start coding in this new IDE.

    Thanks

    0 讨论(0)
  • 2021-01-12 06:38

    you can find it in the directory app/build/generated/source/r/debug/package name.

    0 讨论(0)
  • 2021-01-12 06:45

    Another possibility is that the package you used has some issue - the target package is not the same with the defined one. In turn, R can not be found in the package.

    0 讨论(0)
  • 2021-01-12 06:52

    The folder layout is different to eclipse. I don't think there's a "gen" folder. My "R" file is in the following location:

    (module name)/build/source/r/debug/(package name)/R.java

    I think this file is created when you create a new project using the wizard.

    0 讨论(0)
  • 2021-01-12 06:52

    I had the same problem on linux. I've resolved it installing ia32libs and rebuilding the project. The R class is generated from android.

    0 讨论(0)
  • 2021-01-12 06:56

    Goto to Top right corner in Studio, click on search button enter R.java , you will get the file

    thank you

    0 讨论(0)
提交回复
热议问题