Gopa
Gopa

Reputation: 153

Deprecated Gradle features making it incompatible with Gradle 5.0. Android Studio 3.2

My android app Gradle build is not syncing, since I updated my android studio to 3.2. I have updated everything in the dependencies and still getting the same error. Here are the dependency files that I use ( Including third-party libraries)

    apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "myappid"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 32
        versionName "3.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.11"
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support:design:28.0.0-alpha1'
    implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha1'
    implementation 'com.android.support:support-v4:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-crash:28.0.0-alpha1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation "org.jetbrains.anko:anko:$anko_version"
    implementation 'com.github.GrenderG:Toasty:1.2.5'
    implementation 'com.github.scottyab:showhidepasswordedittext:0.8'
    implementation 'com.daimajia.easing:library:2.1@aar'
    implementation 'com.daimajia.androidanimations:library:2.3@aar'
    implementation 'com.google.android.gms:play-services-ads:17.1.2'
    implementation 'com.google.gms:google-services:4.2.0'
    implementation 'com.github.sd6352051:NiftyDialogEffects:v1.0.3'
    implementation 'net.steamcrafted:load-toast:1.0.12'
    implementation 'com.android.support:animated-vector-drawable:28.0.0-alpha1';

}


//apply plugin: 'com.google.gms.google-services'
//classpath 'com.google.gms:google-services:4.2.0'

However, I am getting the following error Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. Use '--warning-mode all' to show the individual deprecation warnings.

I have tried most things available through Google/Youtube searches. Implemented few answers given in StackOverflow too. But at the end of the day, it's the same error. What I am missing.

Please advice, how to resolve the issue. Thank you

Upvotes: 8

Views: 48897

Answers (5)

Atharva Udapure
Atharva Udapure

Reputation: 21

The Problem is because of the inconsistency of external dependencies. The Issue can be Easily Solved by migrating to Yarn Package Manager

  1. Delete Node Modules

  2. Delete Package.json.lock

  3. yarn install

OR

Try Deleting android/app/build folder

The run the project by react-native run-android

Upvotes: 2

Makarand
Makarand

Reputation: 1123

In my case

  1. I Followed Hugo's answer

  2. Changed the location of project.

  3. Tried another android device [Build and success install]

  4. Tried on my android device [Build and success install]

Upvotes: 0

Sabin Bogati
Sabin Bogati

Reputation: 741

I found easiest way to solve this issue. Go to projectName/android directory and in terminal enter the following command

./gradlew clean

And then, go to main project directory by entering following command

cd ..

And then start the project

react-native run-android

Upvotes: 1

Sushant Gosavi
Sushant Gosavi

Reputation: 3835

Had same issue yesterday extended to the @Hugo Allexis Cardona answer even after replacing deprecated Gradle feature having same issue because Old build folder is remains there so what I did is Remove app/build folder and sync gradle again and it work for me Thanks @Hugo Allexis Cardona

Delete App/Build Folder

Upvotes: 6

Hugo Allexis Cardona
Hugo Allexis Cardona

Reputation: 1432

So the problem doesn't necessarily needs to be in your application level build.gradle script (the one you posted). It can also be in the project level one or even in the maven-publish-aar.gradle one (if you have it). This means, you could be using deprecated Gradle features on any Gradle script.

I have updated everything in the dependencies and still getting the same error.

Most likely, the warning will be gone once you identify and replace any deprecated Gradle feature that's causing you this trouble. To do this, it will help you to actually add the mentioned --warning-mode=all flag to your Gradle command line options (on your Android studio compiler settings):

enter image description here This will print the proper warnings for you to be aware of what are the specific deprecated features your app is using.

In my case (for example), I just added the enableFeaturePreview('STABLE_PUBLISHING') setting on the settings.gradle file and that did the magic (I'm using publishing{}).

Also, I know you asked this near a month ago, but, it might be useful for other people facing the same issue.

Upvotes: 20

Related Questions