Android Studio cannot resolve R in imported project?

后端 未结 30 2032
名媛妹妹
名媛妹妹 2020-11-30 02:27

I\'m trying the new Android Studio. I\'ve exported a project from eclipse, using the build gradle option. I\'ve then imported it in Android Studio. The R.java file under gen

相关标签:
30条回答
  • 2020-11-30 02:47

    At first check if there is import android.R; in top of your class this happens when auto import in enable in android studio.

    after that comment all lines of your code that you use R variable (you can comment entire class or ...) then run application it regenerates R variable and you can uncomment your code.

    0 讨论(0)
  • 2020-11-30 02:49

    None of the answers on the web so far have helped. Build > Make Project did not work for me. For me it was as simple as choosing this other option (on Android Studio 1.3.1):

    Build > Make Module 'module name'

    0 讨论(0)
  • 2020-11-30 02:50

    My problem was that I had file 'default.jpg' in drawable folder and for some reason every resource was not resolved. Fixed after deleting that file!

    0 讨论(0)
  • 2020-11-30 02:51

    I was also facing the same issue and I went through lot of answer on stackoverflow. Then i found one solution which help me resolve this issue.

    Check package name in AndroidManifest.xml file. I forgot to change it while copy pasting another project into new project.

    0 讨论(0)
  • 2020-11-30 02:51

    On IntelliJ 14

    Check if the generated sources are excluded. Usually in Project Structure -> [module] -> Paths -> Compiler output: "Inherit compile output path"

    0 讨论(0)
  • 2020-11-30 02:52

    I had the same problem and got it fixed by deleting an extra library.

    To do try this solution go to File > Project Structure (on a mac you can use the command "Apple ;")

    Then select app on the left tab. Go to the dependencies tab and delete the extra library.

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