Android Studio "Scanning For Files To Index" - android-studio

I am trying to achieve the following project structure in Android Studio
project/
projectA/
projectB/
Where projectA is an "app" module created by Android Studio which I have renamed, and projectB is a Kotlin project I wish to depend on in the app. I can get the projects to appear correctly as modules in my project however no matter what I try, as soon as I add projectB to my Android Studio project, it seems to get stuck in a loop "searching for files to index". When I look at the files it is always just looping through the same 2-3 files. They are always META-INF files but not always the same ones.
How do I successfully add a module to an Android Studio Project without hitting this error or how can I set out my project from the start to achieve this structure?
Thanks.

The problem seemed to be that I had a gradle/ directory under my project/projectB directory that was there because the project was originally created as a standalone project by IntelliJ. Deleting that fixed the issue.

Related

where does gradle put the jars it downloads?

I am using Android Studio with Gradle. Where in my project do I find the jar files that I am pulling with Gradle with say
compile 'com.squareup.picasso:picasso:2.5.2'
Digging through Android Studio I find a xml file under
/Users/myname/StudioProjects/Myproject/.idea/libraries/picasso_2_5_2.xml
I look inside, opened a terminal and routed to the path suggested. I get to the jar. Now I want to browse it. If I source for picasso-2.5.2-sources.jar using Spotlight Search then nothing is found. So obviously I cannot just get to it to view what's inside. So how might I do that?
When running Gradle, a .gradle folder is created in your home directory: ~/.gradle/caches.

How to restore build.gradle and .Gradle folder

When I was trying to solve an issue with Android Studio I accidentally deleted .Gradle folder at the top of the project and build.gradle from within the app. I will post a screen shot of my project in Android Studio. The build tab also produces "make module my app project name" and "deploy module to app engine". The usual clean project, rebuild.... are not there.
How can I restore them?
If your are not using a VCS:
try use the local history to recovery the build.gradle file in your root folder (right click on the root folder)
If it fails. you can create a new project and copy the build.gradle. Usually this file contains generic info (like android gradle pluging and the repos to be used in the modules)
the .gradle folder is not a problem. Gradle wrapper will recreate this file
I copied both from a different project and pasted them in my project. That didn't solve the problem and I imported the project File->new->import project but that only created a duplicate within my project. I closed the project and deleted it from the list of project in Android studio. Then I created a project by importing it from Android Studio Projects folder. It took forever stuck in the gradle build and I have to restart AS manually. Now I have all my files and the project is compiling as it should.
You just need to reimport your project it will by default create the new gradle folder

unable to import library project in android studio

I have modified library project of finestwebview here
I tried to add this library project in to my android studio's project but I got several errors saying configuration with name 'default' not found android studio.need help. I wasted my 1 whole days trying this but unable to add.
what I tried is
I copied the library project into the libs folder of my root project,and added 'include:libs:finestwebview' in setting.gradle file.
Also going to
file->project structure->app->dependencies
added the module and sync the project but cannot achieve the desired outcome.
You are including a project, so for that you should add it as a module, and say compile project in your app's gradle dependencies to use it in your app module.
go to
File->New->Import module and add your library project folder
you will have to name your library project there
then you need to say
`compile project(':yourlibraryProjectname')`
in your gradle dependency

Cloning a project in Android Studio causes gradle exception

I have ligdx/robovm/gradle/android studio project with core, ios, android and desktop subprojects. I wanted to clone android subproject and create very similar one (I named it android-full). I've copy-pasted android directory and renamed it as well as stuff inside it's (build.gradle, AndroidManifest.xml). In settings.gradle I've added 'android-full' to the list. In build.gradle (root directory) I've copy-pasted project(":android") to project(":android-full"). When I'm trying to sync gradle I'm getting an exception:
Error:exception during working with external system:
Full stacktrace from logs here:
http://pastebin.com/T2XUWtYN
A guy from libgdx forums even created github repo with demo project for me (with 2 android subprojects ofc). Gradle works on it without any problem. Here it is: https://github.com/piotr-j/doubledroid
But when I've copy-pasted source code from core/src and android/android-full (without build.gradle) I've immediately got the same exception. I also compared all gradle files with diff checker and they're almost the same (structure is the same as well as version of gradle, I only have more libs).
I use latest android studio (1.4) and gradle 2.4.
I've tried restarting android studio, doing everything again from scratch, deleting .gradle directory, messing in .idea configs and still the same exception, which isn't very informative.
I don't understand how, but I fixed the problem. I just imported it in Eclipse (with gradle plugin). Project appeared without any problem. Then I realized there were fix small bugs in code, cleaned & builded everything again. Then project worked, I closed it and opened Android Studio again. Then it just worked! Some gradle vs android studio bug I guess.

Android Studio breaks a part package into seperate directories

I recently imported a project I have been working on from eclipse to android studio and have been using robolectric to test units of my code. The unit tests are placed in a file system similar to this: src/test/java/com.foo.bar where com.foo.bar is a package. On every reboot of Android Studio the file system breaks a part the directory into src/test/java/com/foo/bar where all of the folders are directories (including the java folder which should be a Java folder).
Has anyone else experienced this problem?

Resources