flutter不安全的未检查操作,并覆盖不推荐使用的api错误



我收到以下错误:

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.

解决此问题所采取的步骤:

更新了以下依赖项:

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

已将渐变文件更新为:

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'
}

还将等级包装更改为等级-6.0.1-all.zip。

但没有运气。我花了一整天的时间来解决这个问题,但已经没有选择了。有人能帮忙吗?

我的应用程序/Gradle文件:

    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'

project/android/app/build.gradle文件中将multiDexEnabled设置为true

defaultConfig {
      ......
       multiDexEnabled true
   }

将其添加到所有项目中的项目级build.gradle.中。请参阅下文以更好地理解。

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.encoding = 'UTF-8'
        options.compilerArgs << "-Xlint:deprecation"
    }
}

最后是这样的:

allprojects {
repositories {
    google()
    mavenCentral()
}
gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.encoding = 'UTF-8'
        options.compilerArgs << "-Xlint:deprecation"
    }
  }
}

并在您的项目/android/app/build.gradle文件中将multiDexEnabled设置为true。

defaultConfig {
  ......
   multiDexEnabled true
}

相关内容

  • 没有找到相关文章

最新更新