Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime JAR files in the classpath have the version 1.4, which is older than the API version 1.5?

I'm getting this error while trying to build a release version of my app. I'm not using kotlin dependencies so can someone tell me how I can fix this, please?

Error Log:

Runtime JAR files in the classpath have the version 1.4, which is older than the API version 1.5. Consider using the runtime of version 1.5, or pass '-api-version 1.4' explicitly to restrict the available APIs to the runtime of version 1.4. You can also pass '-language-version 1.4' instead, which will restrict not only the APIs to the specified version, but also the language features w: /Users/meggan/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.4.32/3546900a3ebff0c43f31190baf87a9220e37b7ea/kotlin-stdlib-jdk7-1.4.32.jar:

My build.gradle (app):

buildscript {
    repositories {
        google()
        maven { url 'https://plugins.gradle.org/m2/' }
    }

}

plugins {
    id 'com.android.application'
    id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
}

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.3'
    defaultConfig {
        applicationId "com.myapp.app"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 10
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        resConfigs "en"
    }

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        exclude("META-INF/*.kotlin_module")
    }
}

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

    // Google Design & Support Dependency
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.palette:palette:1.0.0'
    implementation 'androidx.annotation:annotation:1.2.0'

    // Layout Libs
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.ogaclejapan.smarttablayout:library:2.0.0@aar'

    // Connectivity Libs
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.google.code.gson:gson:2.8.8'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.android.volley:volley:1.2.1'

    // Firebase
    implementation platform('com.google.firebase:firebase-bom:28.4.1')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-config'
    implementation 'com.google.firebase:firebase-crashlytics'

    // OneSignal
    implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'

}

Project build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        gradlePluginPortal()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'

        // Add the Crashlytics Gradle plugin
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url "https://jitpack.io"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
like image 602
Meggan Sam Avatar asked Sep 29 '21 18:09

Meggan Sam


1 Answers

Fixed it simply by running Invalidate Caches / Restart on Android Studio!

like image 138
Meggan Sam Avatar answered Oct 02 '22 01:10

Meggan Sam