0

Im using Android Studio 3.0.1

graddle: gradle-4.6-all

I created a module with empty body structure, when i try to add compile project (:testmodule) to my app build.gradle and sync, it keeps saying could not resolve project :testmodule

This is my app build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.krot.aidltest"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
           minifyEnabled false
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    compile project (':testmodule')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

This is my module (testmodule) build.graddle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.testmodule"
        minSdkVersion 22
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
}

I have tried some methods but it didn't work, please help.

Krot
  • 187
  • 3
  • 13

2 Answers2

0

Finally, i have found the answer for my question. It's because when i tried to New module ... I picked the option Phone & Tablet Module. In fact, it must be Android Library (next to the Phone & Tablet Module) instead the first option.

Krot
  • 187
  • 3
  • 13
-1

Try to use implementation in place of compile.

implementation project (':testmodule')

Edit - Try the following options.

  1. Build > Clean Project.
  2. Build > Rebuild Project.
Porush Manjhi
  • 135
  • 12