Cannot find R.layout.activity_main

后端 未结 29 2358
轮回少年
轮回少年 2020-12-01 01:58

I was trying to work out with multiple layout using some online tutorials. The thing is my program was building and compiling correctly as long as there was only one XML fil

29条回答
  •  爱一瞬间的悲伤
    2020-12-01 02:24

    I had the same problem, fixed by replacing R with com.example.appname.R obviously put your package reference in there instead. Or just add this line to your file:

    import com.your.package.R
    

    Or even better, try removing this line from your code if exists:

    import android.support.compat.R
    

提交回复
热议问题