androiddependenciesjcenter

Cannot use nbsp.materialfilepicker:1.9.1 because it generate org.gradle.internal.resolve.ModuleVersionNotFoundException error


When compiling the app, I receive the following message:

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Followed by: Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.nbsp:materialfilepicker:1.9.1.

Below is my build.gradle file

plugins {
    id 'com.android.application'
}

android {
       compileSdk 33
      
       defaultConfig {
       applicationId "com.teste.filepicker"
       minSdk 19
       targetSdk 33
       versionCode 4
       versionName "4.9b"
       testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 }

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

 namespace 'com.teste.filepicker'

 applicationVariants.all { variant ->
      variant.outputs.all { output ->
      def project = "Filepiker"
      def newApkName = project + ".apk"
      outputFileName = new File(newApkName)
      }
 }

}

dependencies {

 implementation 'androidx.appcompat:appcompat:1.6.1'
 implementation 'com.google.android.material:material:1.9.0'
 testImplementation 'junit:junit:4.13.2'
 androidTestImplementation 'androidx.test.ext:junit:1.1.5'
 androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
 implementation 'com.nbsp:materialfilepicker:1.9.1'

}

And the settings.gradle

pluginManagement {
   repositories {
      google() 
      mavenCentral()
      gradlePluginPortal()
   }
}

dependencyResolutionManagement {
   repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
   repositories {
      google()
      mavenCentral()
      jcenter()
      maven {url 'https://jitpack.io'}
   }
}

rootProject.name = "Filepiker "
include ':app'

The build.gradle file ( Filepiker )

plugins {
id 'com.android.application' version '8.5.1' apply false
id 'com.android.library' version '8.5.1' apply false
}

The problem seems to be that Gradle can no longer find the module com.nbsp:materialfilepicker:1.9.1

How can I fix this?


Solution

  • I solved the problem by finding the aar file of the library that is available at:

    https://maven.moxtra.com/nexus/content/groups/public/com/github/icerockdev/MaterialFilePicker/1.9.1/

    and importing the file locally using the FILE -> PROJECT STRUCTURE option and importing the dependency.

    The file is not available in mavenCentral because it is an old library.