-1

The problem i am having is as follows: The root project of my android studio project should in fact be a module. I imported it ages ago from eclipse and it must not have created the common project -> module directory structure needed for gradle.

This is only now becoming an issue as i have to turn the main code-base into a library project and library projects with gradle can only be created within application modules and not the root project.

so basically my project:

enter image description here

should be looking more like this example that ive made: enter image description here

I have tried adding the wrapping project folder, settings. gradle etc.. in windows explorer and building gradle but to no avail. Is there a way to add a new root to a project in android studio and turn the root into a module without breaking everything??

Note: Making a new project with the correct structure is not an option i dont think because my project is already a remote git repository on other production apps.. Any help would be greatly appreciated.

P.S: If gradle was my girlfriend, i would have broken up with her by now!!

Farhan Shah
  • 2,344
  • 7
  • 28
  • 54
sirFunkenstine
  • 8,135
  • 6
  • 40
  • 57

1 Answers1

0

Figured it out eventually. Adding the wrapping project folder, settings. gradle etc was the right thing to do. Turned out that my app build.gradle folder had the following redundant source set

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

This was preventing gradle from indexing my new main java directory folder and the new location of my app manifest.

sirFunkenstine
  • 8,135
  • 6
  • 40
  • 57