0

I am developing an app, and have started working on main screen design but I am not able to test my app. When I want to test the app it suddenly stop all the time and error showing in catlog in the line

setContentView(R.layout.activity_main)

I have attached the screenshots in this question also.

main activity

halfer
  • 19,824
  • 17
  • 99
  • 186

4 Answers4

1

I invite to you to clean project and rebuild again, you have the how to here.

And remove those imports that contains R in your project.

import vibhor.dev.eat24.R;

import vibhor.dev.eat24.R.layout;

I see you have this :

dependencies {
   classpath 'com.android.tools.build:gradle:3.0.1'
   classpath 'com.google.gms:google-services:3.1.0'
}

Change it to :

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
}

This is problem of your library, take a look on this answer, try it, if it does not work.. just change the library.

Community
  • 1
  • 1
Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148
0

try that solution:

check that the import for R class is not import com.android.R;

and you should make it import yourpackagename.R, then recompile

if it works, your answer has already been replied here.

Aimée
  • 49
  • 6
0

R.java is automatically generated on build, and it is automatically imported so you don't have to import it explicitly.

Try this:

  1. delete generated sub folder in your app folder since R.java is in one of its sub folders

enter image description here

  1. rebuild your project and generated folder will be generated again
colens
  • 467
  • 3
  • 12
0

vibhor vibhoti -- your problem is that you are using ( view ) tag with v small in your activity_main.xml change it to ( View ) with Capital V .. that is the SOLUTION