OUaana
OUaana

Reputation: 24

compile is deprecated replace with implementation

I have just update my android studio to the last version which is 3.3.5 but am really stuck with this problem Gradle DSL method not found: 'compile()' Possible causes: whene tring to add apdf view to my project. knowing that i already have the last version of gradle too . but still it is showing that i should update my grable.

The project 'test' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.3 and sync project

'''

The project 'test' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin

i think it is because the of the source starting by compile but how can i replace it.

Upvotes: 0

Views: 3733

Answers (2)

Bohdan Shvets
Bohdan Shvets

Reputation: 136

To update Gradle plugin to 3.5.3:

In your top-level build.gradle file:

buildscript {
    //...
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        //...
    }
}

To fix the error with compile() method:

In your module-level build.gradle replace compile() with implementation() as follows:

compile 'com.somelibrary:somelibrary:1.0'
// with
implementation 'com.somelibrary:somelibrary:1.0'

testCompile 'com.sometestlibrary:sometestlibrary:1.0'
// with
testImplementation 'com.sometestlibrary:sometestlibrary:1.0'

Upvotes: 1

Thamilvanan
Thamilvanan

Reputation: 189

Update your gradle plugin as well as gradle wrapper version as stated in the URL https://developer.android.com/studio/releases/gradle-plugin

Upvotes: 0

Related Questions