17

Screenshot

I wish if some one can help me in android studio problem?

I just came up while i was working on my application I have no idea whatsoever since i tried all possible solution that can resolve the issues.

Any help will be much appreciated.

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
Yogesh Pandey
  • 217
  • 1
  • 2
  • 4
  • You need to fix all those red highlighted errors first. Then the X mark in 'app' button will disappear. Check if there any missing libraries in gradle dependency. – Amad Yus Aug 29 '16 at 02:15
  • Hi Alex , the problem is none of my imports are working as u can see there is an Red cross Mark in the application button when I try to run the application . I tried to check everything available in internet but its not working , kindly let me know if you have any idea for the same as I running in a tight schedule and I have to finish this ASAP – Yogesh Pandey Aug 29 '16 at 02:17
  • #Amad thanks for your reply , this is not any imported project , I am working on this since 4 weeks now , it was completely fine till 3 hrs ago till I restarted my computer , that red X mark is there since then, its something really silly mistake that I am skipping I think !! – Yogesh Pandey Aug 29 '16 at 02:47

14 Answers14

29

The red X is there saying you cannot build/run your project because it had an error while indexing your application. Sometimes that error occurs when you open a project. All it needs to do is index your code again. A couple things you can do to fix this:

  1. Go into your gradle file, delete something, and type it back. It will ask you to "Refresh" your project.
  2. You may try Cleaning and Rebuilding your project.
  3. Go to File->Invalidate Caches/Restart... and then click Invalidate and Restart.
  4. Basically, reloading your code should fix this problem. If you can find another way to refresh your project and the above did not work, try that way as well.
TheAnonymous010
  • 725
  • 7
  • 19
11

None of the above solutions worked for me. This does the magic!

File > Sync Project with Gradle Files

Farwa
  • 6,156
  • 8
  • 31
  • 46
10

I'm having this error so often, and I find myself coming to this page again and again. Let me just collect the different answers that worked for me.

Solution 1: Combines the ones that @TheAnonymous010 and @Farwa proposed

1.- File > Sync project with Gradle Files

2.- Build > Clean Project, Build > Rebuild Project

Solution 2: Recreating Gradle folder

1.- File > Close Project

2.- You will see a small Android Studio window with a list of projects on the left, click on the "X" mark next to your current project (the one you're working on)

2b.- If you don't see an "X" mark next to the project name, you can right-click and select "Remove from project list"

3.- Now choose "Open an existing Android Studio Project" and re-open it from zero. After the "Indexing..." phase, you'll probably get your app module back to work

Solution 3: File > Invalidate caches and restart > Invalidate and Restart

Solution 4: Select a debug variant, sometimes I had this error because of selecting a release build variant, which has no signature (taken from here)

voghDev
  • 5,641
  • 2
  • 37
  • 41
2

FIRST check you are trying to run the correct Build Variant. When I have this problem, it is usually because I am trying to run a release (signed) variant rather than debug.

**enter image description here**

GraSim
  • 3,830
  • 1
  • 29
  • 35
2

Delete caches folder from C:\Users\user Name\.AndroidStudio(version)\system worked for me.

Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
TheMehedi
  • 31
  • 4
1

Problem is there is confliction of Jre, Go to(File -> Project Structure -> SDK Location), just ticked 'Use embedded JDK'(recommended) checkbox and set JDK location to 'path to the android studio'\Android Studio\jre

Shahbaz Ahmed
  • 459
  • 6
  • 9
1

Its very simple. sometimes when you open your project then this error occur. just write some thing in gradle and remove it then sync it. the error will be gone

1

Steps:

  1. Open File in Android Studio and click on invalidate.

  2. Open File and click on "close project".

  3. One window with headline "welcome to Android studio" will open.

  4. Remove the project from the opened window (probably listed on top), by clicking on "X" mark.

  5. Close the window with headline "welcome to Android Studio".

  6. Open Android Studio, and select the option to "Open and existing android Studio project".

Pang
  • 9,564
  • 146
  • 81
  • 122
1

If it doesn't work with the previous answers, try this:

Sync project with Gradle Files

ΩlostA
  • 2,501
  • 5
  • 27
  • 63
0

Restarting Android Studio did the trick for me

mujeeb
  • 799
  • 5
  • 18
  • 29
0

In Build.gradle file add

compileSdkVersion 23 similar as dependencies

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

Bulid -> Clean project after that rebuilding project

Left-hand side builds Variants click then select project name next column select debug.

SAMUEL
  • 8,098
  • 3
  • 42
  • 42
0

Shut Down Project. Now, Go to File-> New -> Import Project Select Project

It work for me, hope it will help others.

Rahul Khatri
  • 1,502
  • 2
  • 13
  • 25
0

Click on the app option. Then click on edit configuration

enter image description here

Now at the bottom Error is shown. Resolve the error as per the requirement

enter image description here

keikai
  • 14,085
  • 9
  • 49
  • 68
Gourav rawat
  • 1
  • 1
  • 1
0

updating android studio works for me.

hassan mirza
  • 139
  • 2
  • 8