Android Studio with Mainactivity Problem

Asked

Viewed 2,629 times

1

I started using Android Studio today, and when creating the App Project I came across a problem: I can create, but the Mainactivity class is full of errors and I haven’t changed anything in the application.

inserir a descrição da imagem aqui

Is that, have you by any chance encountered this problem ? Before Android Studio I used Eclipse. Thank you!

  • Do you use Gradle? see if something changes when you click on the button Sync Project with Gradle Files (image).

  • No, it hasn’t changed.

  • By the image there must be something wrong with the directory structure, something incorrect. Try to clear the cache by going to File - Invalidate Cache.

  • It’s not worked out.

  • Friend, try going in "build", then click clean , click rebuild and then make project. After that, let him perform the synchronizations, and restart android studio .

  • Restart, it still didn’t work..

  • Ali em extends, try to extend Activity .

  • Didn’t work out .

  • You’re saying the problem may have been due to incorrect daemon configuration. @Qmechanic73

  • Dude I guess I didn’t set up a Gradle, you have to set up in the Environment Variables ? @Qmechanic73

  • Try to read the terminal, sometimes I had problem in R by Nomeclatura errors, for example this error happened to me and disappeared soon after I fix an xml error that I had put a dash instead of underline , Again it was fixed right after I fixed the string word that was written "Sting"

  • try switching to extends Activity

Show 7 more comments

1 answer

6


To solve this, do it:

  • Clean project located in Build
  • Rebuild project located in Build, after the end of the Clean Project.

Remember that the class R is created automatically after the Build of your project, that is, if any Build your ended with error, this class will no longer exist and you will have to give a Build in it again.

  • Took the other errors plus class R is still error

  • Gradle build finished with 101 error(s) in 15 sec

  • Right, the mistakes are all in class R? I need you to show me your AndroidManifest.xml and the Build.gradle (app).

  • I also ask that you take a look at package that you are using in .java/.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.