Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter unsafe unchecked operation and overtiding a deprecated api errors

I am getting the following errors:

Note: /Users/D/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/D/flutter/.pub-cache/hosted/pub.dartlang.org/share-0.6.3+6/android/src/main/java/io/flutter/plugins/share/SharePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/D/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.5/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/D/flutter/.pub-cache/hosted/pub.dartlang.org/square_in_app_payments-1.3.0/android/src/main/java/sqip/flutter/internal/CardEntryModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Steps taken to resolve this:

Updated dependencies to the following:

cupertino_icons: ^0.1.3
  firebase_core: ^0.4.4+2
  firebase_auth: ^0.15.5+2
  google_sign_in: ^4.1.4
  image_picker: ^0.6.3+4
  cloud_firestore: ^0.13.4
  percent_indicator: ^2.1.1+1
  uuid: ^2.0.4
  share: ^0.6.3+6
  path_provider: ^1.6.5
  barcode_scan: ^2.0.1
  intl: ^0.16.1
  square_in_app_payments: ^1.3.0
  http: ^0.12.0+4
  firebase_storage: ^3.1.3
  firebase_crashlytics: ^0.1.3
  firebase_dynamic_links: ^0.5.0+11

Updated gradle file to:

dependencies {
    classpath 'com.android.tools.build:gradle:3.5.3'
    classpath 'com.google.gms:google-services:4.3.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'io.fabric.tools:gradle:1.31.0'
}

Also changed grade wrapper to gradle-6.0.1-all.zip.

but no luck. I have spend entire day to resolve this but have run out of options. Anyone can help, please?

My App/Gradle file:

    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 GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    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.0'
}


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

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 29
    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "my application package name"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode  18 //flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            multiDexKeepFile file('multidex-config.txt')
            minifyEnabled true //  - true done
            useProguard false //  - true done

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'


        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

}

apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
like image 816
Damandroid Avatar asked Oct 15 '22 05:10

Damandroid


1 Answers

Set multiDexEnabled to true in your project/android/app/build.gradle file.

defaultConfig {
      ......
       multiDexEnabled true
   }
like image 65
keptac Avatar answered Oct 18 '22 19:10

keptac