'"Could not resolve net.java.dev.jna:jna-platform" in Gradle when I have integrated Firebase

The error is:

Could not resolve net.java.dev.jna:jna-platform

In the integration of Firebase to mu Grandle I get an error. I don't know if it's because the structure of the document was modified, since in mine it didn't contain "buildscript","allprojects".

I'm programming with java, not with kotlin in case it can help. My gradle.app is

 plugins {

    id 'com.android.application'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.whatdowant"
        minSdk 24
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    ///Implement para  FIREBASE
    implementation 'com.google.firebase:firebase-auth:21.0.3'
    implementation 'com.google.android.gms:play-services:play-services-auth:17.0.0'
    implementation 'com.google.firebase:firebase-analytics'
    implementation platform('com.google.firebase:firebase-bom:29.3.1')

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

apply plugin: 'com.google.gms.google-services'



> `My gradle. project is:`



buildscript {
    ext.kotlin_version = "1.5.0"
    repositories {
        // Check that you have the following line (if not, add it):
        google()  // Google's Maven repository
    }

    dependencies {
        // Add the following line:
        classpath 'com.google.gms:google-services:4.3.10'  // Google Services plugin
        classpath "com.android.tools.build:gradle:4.2.2"

    }
}

allprojects {

    repositories {
        mavenCentral()
        google()  // Google's Maven repository


    }
}
```


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source