Warning after upgrading Android Gradle Plugin to 7.1.1

122
May 05, 2022, at 6:50 PM

After upgrading Android Gradle Plugin from 7.0.3 to 7.1.1, while building my project I get the following warning:

> Task :app:hiltAggregateDepsDebug
WARNING: [Processor] Library '/home/XXXX/.gradle/caches/transforms-3/XXXXXXX/transformed/core-1.7.0-api.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/core/R$styleable'
 Example of support library reference: 'android/support/v4/app/INotificationSideChannel$Default'
[Processor] Library '/home/XXXXX/.gradle/caches/transforms-3/XXXXXXX/transformed/core-1.7.0-api.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.

Project info - Android Kotlin w/ Jetpack compose:

kotlin_version = '1.5.31'  
compose_version = '1.0.5'  
hilt_version = '2.40.5'
classpath 'com.android.tools.build:gradle:7.1.1'

I am using Android Studio Bumblebee | 2021.1.1 Patch 1.

Why is this warning happening? How can I fix this?

Answer 1

In all likelihood, your Compose and Kotlin versions are out of date. Try using these settings in your project's gradle.build:

buildscript {
    ext {
        compose_version = '1.1.0-rc01'
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.1'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
    }
}

You should also update your app's build.gradle file (and those in other modules) to have something like this:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}
android {
    compileSdkVersion 31
    buildToolsVersion "31.0.0"
    defaultConfig {
        applicationId "dev.wirespec.topdog"
        minSdkVersion 21
        targetSdkVersion 31
        versionName "1.0.0"
    }
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
        useIR = true
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
        kotlinCompilerVersion '1.6.0'
    }
}

While this uses Java 11, you can still stick with Java 8 if you have to.

Finally, you should update the latest version of the Kotlin plugin which is version 211-1.6.10-release-923-AS7442.40

Android Studio > Preferences > Languages & Frameworks > Kotlin

Rent Charter Buses Company
READ ALSO
Flutter run error. exiting with code 1 Could not resolve all artifacts for configuration ':classpath'

Flutter run error. exiting with code 1 Could not resolve all artifacts for configuration ':classpath'

I am trying to run my first flutter app in visual studio code, but when I run flutter run -v, execution end it with errorSee it below:

80
Remove a variable of a class from another part of the code

Remove a variable of a class from another part of the code

I have a class that I pass as a parameter to a functionThis class contains various companion objects

125
Detect selected file type in onActivityResult

Detect selected file type in onActivityResult

I'trying to open camera with video and photoThis code working correctly but in onActivityResult can't check file type

111
How do ensure the flutter app is working on all android devices out there?

How do ensure the flutter app is working on all android devices out there?

We have a flutter app on iOS and android and we test on 2 or 3 android devices before every release and it works fine without any issueBut when I see in the review, people are giving 1 star says that the app is not working for them

97