Android Studio Multi Module Project Gradle Sync Failed

Viewed 2376

I'm creating a multimodule project with an app module, a server module and a shared module. When I run ./gradlew build in the LetsGo root directory it returns without any errors. If I open the project in android studio though I'm getting some weird errors and my design editor isn't showing anything because of an incorrect sync. Even though everything in the sync tab gets a green checkmark, it still spits out errors. I invalidated the caches already, but that's not helping. I'm trying to give as much information as possible, so the next part might be a bit long. But I think I ordered them in what is most to least relevant.

The sync errors:

On the project LetsGo:

Gradle Daemon started in 876 ms
<ij_msg_gr>Other<ij_msg_gr><ij_nav>/Users/koen/Vakken/Architecture_and_design/letsgo/LetsGo/app/build.gradle<ij_nav><i><b>project ':app': Unable to resolve all content root directories</b><eol>Details: java.lang.NullPointerException: null</i>
<ij_msg_gr>Tests model errors<ij_msg_gr><ij_nav>/Users/koen/Vakken/Architecture_and_design/letsgo/LetsGo/app/build.gradle<ij_nav><i><b>project ':app'</b><eol>Details: java.lang.NullPointerException: null</i>

CONFIGURE SUCCESSFUL in 9s

On the project :server (even though I don't think this should be a different sync)

Task 'wrapper' not found in project ':server'.

Error log is at https://pastebin.com/nq6HpmGi

in gradle.properties I set the following variables:

kotlin_version=1.3.61
gradle_version=3.6.1

./gradlew projects output

Root project 'LetsGo'
+--- Project ':app'
+--- Project ':common'
\--- Project ':server'

Quick dump of my gradle files:

settings.gradle

include ':app', ':common', ':server'
rootProject.name='LetsGo'

build.gradle

LetsGo

buildscript {
    ...

    dependencies {
        // Gradle/Kotlin Core
        classpath "com.android.tools.build:gradle:$gradle_version"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        ...
    }
}

allprojects {
    group 'com.kvw.letsgo'
    version '0.0.1'
    repositories {
        ...
    }
}

project(':app') {
    repositories {
        ...
    }
}

project(':server'){
    repositories {
        ...
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

:server

plugins{
    id 'kotlin'
    id 'application'
    ...
}

mainClassName = "io.ktor.server.netty.EngineMain"

sourceSets {
    main.kotlin.srcDirs = main.java.srcDirs = ['src']
    test.kotlin.srcDirs = test.java.srcDirs = ['test']
    main.resources.srcDirs = ['resources']
    test.resources.srcDirs = ['testresources']
}

dependencies {
    implementation project(':common')
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    ...
}

:app

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    ...
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.kvw.letsgo.client"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        ...
    }
    ...
    compileOptions {
        sourceCompatibility = 1.8
        targetCompatibility = 1.8
    }

    ...
}

dependencies {
    // Local
    implementation project(':common')
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    ...
}

And finally for completeness here's the output of tree LetsGo -L 2

LetsGo
├── LetsGo.iml
├── app
│   ├── app.iml
│   ├── build
│   ├── build.gradle
│   ├── libs
│   ├── proguard-rules.pro
│   └── src
├── build
│   ├── intermediates
│   └── kotlin
├── build.gradle
├── common
│   ├── build
│   ├── build.gradle
│   ├── common.iml
│   ├── libs
│   └── src
├── gradle
│   └── wrapper
├── gradle.properties
├── gradlew
├── gradlew.bat
├── local.properties
├── server
│   ├── build
│   ├── build.gradle
│   ├── resources
│   ├── server.iml
│   ├── src
│   └── test
├── settings.gradle
└── versions.gradle
0 Answers
Related