Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Marked as an error code in Android Studio, but successfully build gradle and run on the device

i have problem with my code. My Code marked as an error code in Android Studio, but successfully build gradle and run on the device, like this : enter image description here

current configure:

  1. My current project uses a lot of libraries in dependencies. But if the project with little library will not be marked errors like this.
  2. Android Studio 1.5 RC1
  3. compileSdkVersion 'Google Inc.:Google APIs:23
  4. buildToolsVersion '23.0.2'
  5. classpath 'com.android.tools.build:gradle:1.3.1'

activity I have done but have not solved the problem:

  1. always clean > re-build project
  2. invalidate caches / restart > open Android studio > open this project
  3. Close android studio > restart computer > open again android studio > open this project
  4. Update Android version and SDK version 5.Uninstall Android Studio > Re-Install Android Studio > Open Project

edited: it's seems error each code from android support like recyclerview, CardView, APpCompact

this my depedencies

dependencies {
    compile project(':android-crop')
    compile project(':RTEditor-Toolbar')
    compile files('libs/apache-mime4j-0.6.jar')
    compile files('libs/httpmime-4.1.3.jar')
    compile files('libs/jetbrains-annotations.jar')
    compile files('libs/gcm.jar')
    //three party library
    compile('com.crashlytics.sdk.android:crashlytics:2.5.1@aar') {
        transitive = true;
    }
    compile('cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2') {
        exclude module: 'support-v4'
    }
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.vinaysshenoy:mugen:1.0.1'
    compile 'com.github.clans:fab:1.5.5'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.github.curioustechizen.android-ago:library:1.3.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.github.chrisbanes.photoview:library:+'
    compile 'com.subinkrishna:circularimageview:1.0.2'
    compile 'me.leolin:ShortcutBadger:1.1.3@aar'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'cn.trinea.android.common:trinea-android-common:4.2.15'
    compile 'com.sothree.slidinguppanel:library:3.1.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
}

so how fix ? thanks for advance

like image 308
Amay Diam Avatar asked Nov 17 '15 00:11

Amay Diam


Video Answer


2 Answers

None of the things mentioned earlier here did actually work for me But then I found this menu entry in the file menu Invalidate Caches/Restart which appears to have fixed the problem.

I don't really know what happened in the background but when Android Studio started up again the status bar said Indexing... for a minute or so which apparently did wonders.

if it still not working solution is very simple i have tried also

it was just go to help menu and check for update then restart android studio

as attached photo

enter image description here

like image 81
mahmoud zaher Avatar answered Oct 16 '22 16:10

mahmoud zaher


If your project builds in gradle, but Android Studio displays errors, chances are that the Intellij caches are corrupt. In some cases, the menu option you already mentioned "invalidate caches / restart" is not enough. You can try the following:

  1. Shutdown AS
  2. Manually delete the cache dir. On Windows, this is likely to be in a path like C:\Users\YOURNAME.AndroidStudio1.4\system\caches.
  3. Restart AS
like image 37
Mike Wallstedt Avatar answered Oct 16 '22 17:10

Mike Wallstedt