0

I use android studio with sdk v24. When I create my new application and just go to the MainActivity.jar It shows me many codes red? Here it is that I'm talking about:(screen shot)

https://dl.dropboxusercontent.com/u/100174344/Screenshot%202015-01-06%2008.06.09.png

I'm really confused. How can I fix these errors?

NOTE: my sdk is up to date (as you see here: https://dl.dropboxusercontent.com/u/100174344/Screenshot%202015-01-06%2008.22.28.png ) and I've added this code to my build.gradle(Module: app) :

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3' }

EDIT: I'm sorry I create a new project and still it show me the codes, red but I can run it in AVD. what's the problem?

4 Answers4

0

You want To add android.support.v7.jar not added that y i think this error occurs.

add this in your project property file

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.+'
}
Dilavar Malek
  • 1,157
  • 11
  • 18
  • maybe. but when I write the import code manually I can write it up to here: "import import android.support.v7" but after that, it's going to crash – Mohammad Tahvildary Jan 06 '15 at 04:48
  • no first you orgnize import in studio. and then You can not see the v7 jar classes. measns it can not reference to your v7.jar – Dilavar Malek Jan 06 '15 at 04:51
0

Did you added android.support.v7.jar? Just make sure your sdk is updated and you've added android.support.v7.jar. Also check the dependencies.

Rashad
  • 11,057
  • 4
  • 45
  • 73
0

You need to add appcompat v7 dependencies to the app gradle file. Ensure build.gradle(Module : app) is having the dependency. If not available then add and sync the project It should be like-

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.+'
}
Sanjeet A
  • 5,171
  • 3
  • 23
  • 40
  • You don't need to add android.support.v7.jar in the libs folder.Remove it and re sync. Post the Error Message you are getting. – Sanjeet A Jan 06 '15 at 05:39
0

I found the problem I don't know why but when I changed the theme by this structure the issue is up.

Community
  • 1
  • 1