Sovit Nayak
Sovit Nayak

Reputation: 125

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapbox/android/core/FileUtils

I am trying to run MapBoxMap and Flutter_Mapbox_Navigation together and the app keeps crashing in when I enter the Map screen . This is the erorr that keeps on coming . I have tried all the methods mentioned but still keeps crashing .

enter image description here

Here is my code block dependencies

plugins {
  id 'com.android.application'
  // Add the Google services Gradle plugin
  id 'com.google.gms.google-services'
  id 'kotlin-parcelize'
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"




android {
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion



    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }


        buildFeatures 
    {
        viewBinding = true
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.notifyme"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 23
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
            minifyEnabled true
            shrinkResources true
        }
    }

        configurations {
        all*.exclude module: 'mapbox-android-core' // This removes all other versions of `support-v4` if gets duplicated from all the artifacts.
        all*.exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-telemetry'
    }
}

flutter {
    source '../..'
}



dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
  // Import the Firebase BoM
  implementation platform('com.google.firebase:firebase-bom:32.1.1')

implementation('com.mapbox.mapboxsdk:mapbox-android-core:5.0.0') {
         exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-core'
}

  // TODO: Add the dependencies for Firebase products you want to use
  // When using the BoM, don't specify versions in Firebase dependencies
  implementation 'com.google.firebase:firebase-analytics-ktx'
implementation platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")
implementation "androidx.multidex:multidex:2.0.1"


  // Add the dependencies for any other desired Firebase products
  // https://firebase.google.com/docs/android/setup#available-libraries
}

Please let me know if any other info is needed .

Upvotes: 1

Views: 183

Answers (0)

Related Questions