Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Studio indexing every 2 seconds #1735

Closed
lwasyl opened this issue Feb 4, 2018 · 33 comments
Closed

Android Studio indexing every 2 seconds #1735

lwasyl opened this issue Feb 4, 2018 · 33 comments

Comments

@lwasyl
Copy link

lwasyl commented Feb 4, 2018

In Android Studio 3.1 Beta 1 (and 3.2 Canary 1) indexing is triggered every 2 seconds, which makes e.g. code completion tooltips go away. Excerpt from the log (this continues forever):

2018-02-04 12:39:19,749 [e-1024-b01]   INFO - pl.ProjectRootManagerComponent - project roots have changed
2018-02-04 12:39:19,762 [ thread 11]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 1ms; general responsiveness: ok; EDT responsiveness: ok
2018-02-04 12:39:19,772 [ thread 11]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 10ms; general responsiveness: ok; EDT responsiveness: ok
2018-02-04 12:39:21,760 [e-1024-b01]   INFO - pl.ProjectRootManagerComponent - project roots have changed
2018-02-04 12:39:21,772 [ thread 12]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 0ms; general responsiveness: ok; EDT responsiveness: ok
2018-02-04 12:39:21,776 [ thread 12]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 4ms; general responsiveness: ok; EDT responsiveness: ok

This also happens when there's no tab with Flutter/Dart code.

Steps to Reproduce

Version info

[✓] Flutter (on Mac OS X 10.13.3 17D47, locale en-PL, channel dev)
• Flutter version 0.0.22 at /Users/wasyl/flutter
• Framework revision 3001b3307d (5 days ago), 2018-01-30 11:37:15 -0800
• Engine revision 8f2d72b183
• Tools Dart version 2.0.0-dev.16.0
• Engine Dart version 2.0.0-edge.7af4db0ea091dddca6b2da851e6dda8d7f9467e8

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/wasyl/Library/Android/sdk
• Android NDK at /Users/wasyl/Library/Android/sdk/ndk-bundle
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = /Users/wasyl/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[-] iOS toolchain - develop for iOS devices
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup

[✓] Android Studio
• Android Studio at /Applications/Android Studio 3.2 Preview.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Android Studio
• Android Studio at /Applications/Android Studio 3.1 Preview.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[-] IntelliJ IDEA Community Edition (version 2017.3.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.io/intellij-setup/#installing-the-plugins

[-] Connected devices
• None

@devoncarew
Copy link
Member

This is in android studio 3.1 (not in the stable android studio)?

This looks suspicious:

INFO - pl.ProjectRootManagerComponent - project roots have changed

but I'm not sure what would be causing it. This:

This also happens when there's no tab with Flutter/Dart code.

Makes me think that this is an issue with Android Studio itself, and not necessarily the Dart or Flutter plugins. Perhaps re-file this issue here: https://developer.android.com/studio/report-bugs.html ?

@lwasyl
Copy link
Author

lwasyl commented Feb 5, 2018

I don't have much time, so will investigate later, but regular (big) Android project doesn't trigger indexing, and I've been working on 3.1 for a long time now, and never had this problem.

I've tinkered a bit with the project, removing things one by one, and at some point indexing stopped and seemed to work after I restored all the files. But as soon as I restarted Android Studio, indexing is resumed, and removing things from iml file doesn't seem to work.

Things I've tried that seem to help (sometimes) is removing and readding contents of configuration tag in .._android.iml project. This triggers autogeneration error and indexing stops, but I'm not sure whether everything works normally afterwards

@stevemessick
Copy link
Member

Fixed in #1908

@geiszla
Copy link

geiszla commented Mar 27, 2018

I just updated to Android Studio 3.1 and have the same problem. How do I convert my existing project to get rid of this constant refreshing?

The workaround of @lwasyl worked until I restarted Android Studio, when the issue came back.

@devoncarew
Copy link
Member

We're releasing a new version of the plugin shortly which will address this; thanks for your patience!

@stevemessick
Copy link
Member

For those who are curious, you need to change your android facet (in the module definition *.iml file) to include this:

<option name="ALLOW_USER_CONFIGURATION" value="false" />

That is required by a change in the Android Studio code that was made in 3.1. You can dig through #1908 for the details.

@acidjazz
Copy link

@stevemessick where exactly do i put this in my .iml file(s)? I've tried in various spots and the indexing/insanity continues

@lemonboston
Copy link

@acidjazz I've added that line in the <myproject>_android.iml file at the root (not in <myproject>.iml). It looks like this currently:

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="android" name="Android">
      <configuration>
        <option name="ALLOW_USER_CONFIGURATION" value="false" />
        <option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/android/gen" />
        <option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/android/gen" />
        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/android/AndroidManifest.xml" />
        <option name="RES_FOLDER_RELATIVE_PATH" value="/android/res" />
        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/android/assets" />
        <option name="LIBS_FOLDER_RELATIVE_PATH" value="/android/libs" />
        <option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/android/proguard_logs" />
      </configuration>
    </facet>
  </component>
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$/android">
      <sourceFolder url="file://$MODULE_DIR$/android/app/src/main/java" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/android/gen" isTestSource="false" generated="true" />
    </content>
    <orderEntry type="jdk" jdkName="Android API 27 Platform" jdkType="Android SDK" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" name="Flutter for Android" level="project" />
  </component>
</module>

@SeaRoth
Copy link

SeaRoth commented Mar 28, 2018

@acidjazz dude instead of waiting for someone else to fix - find a way. Download an older version of Android Studio, do some searching on StackOverflow, follow the instructions above. The longer you wait for someone else to solve your problems the more miserable you will become. Become your own hero.

@stevemessick
Copy link
Member

To fix the refresh issue on projects already open in 3.1 you need to close them then re-open them. Use the Welcome screen item named Open an existing Android Studio project. See #2017 for more info.

@acidjazz
Copy link

acidjazz commented Mar 28, 2018

@SeaRoth lol that's been the struggle.

@stevemessick closing and re-opening projects did not work.

I did finally find a way to stop the poltergeist was to kill my .idea folder completely and then re-activate the flutter and dart plugins, this was suggested by @tamcy here

@devoncarew
Copy link
Member

devoncarew commented Mar 28, 2018

Thanks all for the feedback, and sorry for the indexing issues.

It sounds like from above, that deleting the .idea/ folder will work to address the re-indexing issue.

We're also looking to release a patch to the current release, which will disable the android studio setting (<option name="ALLOW_USER_CONFIGURATION" value="false" />) for each project once, as we open it.

@acidjazz
Copy link

@devoncarew I'm sorry to be a bearer of bad news but that method didn't last long for me, see here

@mt8024
Copy link

mt8024 commented Apr 9, 2018

Deleting the .idea/ folder works well for Android-Studio 3.1.
Rollback Android studio to 2.3 also works :)

@ifeins
Copy link

ifeins commented Apr 23, 2018

@stevemessick This is happening to me on a regular Android Java project - no Kotlin or Flutter involved.
Deleting the .idea folder didn't solve the problem, nor did closing/re-opening the project or restarting the ide and even the computer.

I'm using Android Studio 3.1.1, Gradle 4.4 and Android Gradle plugin 3.1.1.
My project is a multi-module project (not sure if it's related).

This causes the IDE to become unusable as it causes the UI to blink every second.

I've just noticed that this is a repo for flutter (arrived here from a Google search on AS indexing all the time) so this might not be the best place to post it.
Sorry about that, but I couldn't find anywhere else where this issue was being discussed.

@ifeins
Copy link

ifeins commented Apr 23, 2018

I've submitted an Android Studio bug report - https://issuetracker.google.com/issues/78378464
Can you help investigate?

@amitks2015
Copy link

amitks2015 commented Apr 30, 2018

Any stable solution yet? It seems to be unusable now.

Update: File -> Invalidate Caches / Restart.. helped me. Now don't see this problem with Android Studio 3.1.2

@devoncarew
Copy link
Member

Hi - as per #2017 - if your comments are about continuous indexing when using Android Studio without it being a Flutter project, please follow up on the above Android Studio bug; thanks!

@JotaFerreira
Copy link

File -> Invalidate Cache/ Restart... works for me

@andasl
Copy link

andasl commented May 25, 2018

not in this project ,I met this probrem more then one time,
do it just clean project, and then is fine

@tmetn
Copy link

tmetn commented May 30, 2018

Invalidating cache helped me too, thanks!

@diogo10
Copy link

diogo10 commented Jun 8, 2018

Invalidating cache helped me too, thanks! (On a Java/Kotlin based project)

@turgutsonmez
Copy link

File / Invalidate Cache / Invalidate and Restart helped me too thanks

@PremUkkoji
Copy link

File / Invalidate Cache / Restart worked . Thank you

@zenith22
Copy link

File / Invalidate Cache / Invalidate and Restart helped me too thanks

@rizwan49
Copy link

rizwan49 commented Aug 8, 2018

File/invalidate cache/ after that restart and it will be fine

@isnafirdasari
Copy link

yeah just click File/invalidate cache/invalidate and restart, and the problem about indexing solved

@yashovardhan99
Copy link

I'm programming in Java so I'm not sure if this is relevant but I noticed that this issue started when I typed in R (to refer to a layout file) in a fragment class. Strangely, if I removed the R, the indexing stopped.
Invalidating the cache/restart did help stop the issue though.

@cam510
Copy link

cam510 commented Sep 17, 2018

File / Invalidate Cache / Restart worked not work for me T_T
flutter 0.7.3 linux
android studio 3.1.4
project : java/switf

@mliitfall
Copy link

mliitfall commented Sep 20, 2018

At first it seems to work using File / Invalidate Cache / Invalidate and Restart,
but it still indexing, using 3.1.4 on MacOS 10.13.6
Edit: After installing a Plugin Suggestion pop up, it fix the problem.

@bluevelvet
Copy link

bluevelvet commented Dec 16, 2018

<option name="ALLOW_USER_CONFIGURATION" value="false" /> works for me.
android studio: 3.2.1
project: decompiled apk -> smali

@sudhanshusharma2010
Copy link

deleting .idea folder is working. thanks for the person who provide this idea :)

@macawile21
Copy link

I have also encountered this problem at version 3.1.3 when I renamed the project folder(added date and time like this:080119_0130am). I just renamed this back to a shorter name to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests