flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[cloud_firestore] CloudFirestorePlugin.java uses or overrides a deprecated API

Open insinfo opened this issue 7 years ago • 20 comments

When I compile I see these notes on the console screen

Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.4.0+1\android\src\main\java\io\flutter\plugins\firebase\core\FirebaseCorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

pubspec.yaml

name: appjazz
description: Aplicativo do Jazz e Blues
version: 8.0.0+8

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  cupertino_icons: ^0.1.2
  http: ^0.12.0+2
  path_provider: ^1.4.0
  sqflite: ^1.1.7+2
  connectivity: ^0.4.5+3
  url_launcher: ^5.2.5 
  cloud_firestore: ^0.12.10
  firebase_auth: ^0.14.0+8
  google_sign_in: ^4.0.11
  firebase_database: ^3.0.9
  rxdart: ^0.22.6  
  webview_flutter: ^0.3.15+1
  auto_size_text: ^2.1.0 
  latlong: ^0.6.1
  queries: ^0.1.12
  firebase_analytics: ^5.0.6
  shared_preferences: ^0.5.4+3

dev_dependencies:
  flutter_test:
    sdk: flutter

  intl_translation: ^0.17.7


flutter:
 
  uses-material-design: true
  
  assets:
    - assets/logoJazz.png
    - assets/bakground.jpg   
    - assets/fundo1.jpg
    - assets/fundo2.jpg
    - assets/fundo3.jpg     
    - assets/userAvatar.png
    - assets/logo-pmro-2018-cinza.png
    - assets/pmro2018-logo.png
    - assets/termos.txt
    - assets/sobreHeader.jpg
    - assets/backgroundMenu.png
    - assets/wood.jpeg
    - assets/praia.jpeg
    - assets/praia2.jpeg
    - assets/logoSVG.svg

  fonts:
     - family: Big Noodle Titling
       fonts:
         - asset: fonts/big_noodle_titling.ttf
     - family: GlosaDisplayW01-Bold
       fonts:
         - asset: fonts/glosa_display_w01_bold.ttf
     - family: BakerieSmoothCondensedMedium
       fonts:
         - asset: fonts/BakerieSmoothCondensed-Medium.otf
     - family: BakerieSmoothBold
       fonts:
         - asset: fonts/BakerieSmooth-Bold.otf
     - family: iconsmind
       fonts:
         - asset: fonts/iconsmind.ttf
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [versão 10.0.18362.418], locale pt-BR)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.5)
[√] IntelliJ IDEA Community Edition (version 2019.1)
[!] IntelliJ IDEA Ultimate Edition (version 2018.3)
    X Flutter plugin not installed; this adds Flutter specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2019.1)
[√] VS Code (version 1.39.2)
[√] Connected device (1 available)

insinfo avatar Nov 11 '19 16:11 insinfo

Seeing the same warnings.. any solution for this yet ?

travellertech avatar Nov 14 '19 11:11 travellertech

me too :(

ialexies avatar Nov 16 '19 04:11 ialexies

I see the warning too.

zaheddec avatar Nov 16 '19 05:11 zaheddec

in your android/app/build.gradle file set the minSdkVersion 21 or add this implementation "androidx.multidex:multidex:2.0.0" in your dependencies at android/app/build.gradle file

touhidsunny avatar Nov 17 '19 03:11 touhidsunny

me too :(

shiga0 avatar Nov 20 '19 12:11 shiga0

in your android/app/build.gradle file set the minSdkVersion 21 and modify compileSdkVersion 29 and targetSdkVersion 29

if it does not work

add this implementation "androidx.multidex:multidex:2.0.0" in your dependencies at android/app/build.gradle file

and modify compileSdkVersion 29 and targetSdkVersion 29

yuyuman avatar Nov 21 '19 04:11 yuyuman

add this implementation "androidx.multidex:multidex:2.0.0" i

and modify compileSdkVersion 29 and targetSdkVersion 29

I've done the above but still getting the errors, also ran flutter clean and all that jazz

ThomasValois avatar Nov 21 '19 13:11 ThomasValois

@yuyuman
@touhidsunny I keep getting these messages even after the modifications

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.")
}

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"
//inicio alteração
apply plugin: 'com.google.gms.google-services'
//fim
android {
    compileSdkVersion 28

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "br.gov.rj.riodasostras.appsescverao"
        minSdkVersion 21
        multiDexEnabled true
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

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

flutter {
    source '../..'
}

dependencies {
    //inicio alteração para abilita multidex e firebase
    implementation 'com.android.support:multidex:2.0.0' //1.0.3
    implementation 'com.google.firebase:firebase-core:17.2.1'
    //fim
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

//inicio alteração
apply plugin: 'com.google.gms.google-services'
//fim
flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle...                                              0,8s
Resolving dependencies...                                           4,4s
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10\android\src\main\java\io\flutter\plugins\firebase\
cloudfirestore\CloudFirestorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.12.10\android\src\main\java\io\flutter\plugins\firebase\
cloudfirestore\CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\connectivity-0.4.5+3\android\src\main\java\io\flutter\plugins\connectivity
\ConnectivityBroadcastReceiver.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher-5.2.5\android\src\main\java\io\flutter\plugins\urllauncher\We
bViewActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Calling mockable JAR artifact transform to create file: C:\Users\isaque\.gradle\caches\transforms-1\files-1.1\android.jar\08609e27
9de7e49282898e1cc00f16fa\android.jar with input C:\Users\isaque\AppData\Local\Android\sdk\platforms\android-28\android.jar
Running Gradle task 'assembleRelease'...

insinfo avatar Nov 22 '19 19:11 insinfo

Am having the same problem.

carlleeswanson avatar Nov 25 '19 06:11 carlleeswanson

I had the same issue and combined two suggested fixes to get it to finally work:

  1. minSdkVersion 21, change to 23
  2. run "flutter pub upgrade" = issues fixed!

To double-check what the fix was: I also reverted back to 21, and invalidated + flutter clean and the issue appeared again. Then i changed to 23 and the warnings disappeared!

FlashJonas avatar Nov 25 '19 14:11 FlashJonas

I did your suggestion but also recreated my emulators and it worked! Now time to fix the many other issues 🙄 Cheers @FlashJonas

ThomasValois avatar Nov 25 '19 16:11 ThomasValois

@FlashJonas But this is not a solution to the problem, because if you change minSdkVersion to 23 the App loses compatibility with Android 5 which is a version supported by Flutter.

insinfo avatar Nov 26 '19 13:11 insinfo

This definitely isn't the prettiest of solutions but luckily I am developing this app for in-house use so I'll be using the latest version of Android. However like @insinfo said, this does start limiting the total number of targetable devices!

ThomasValois avatar Nov 26 '19 13:11 ThomasValois

in your android/app/build.gradle file set the minSdkVersion 21 or add this implementation "androidx.multidex:multidex:2.0.0" in your dependencies at android/app/build.gradle file

This worked for me. Thank you

gordonturibamwe avatar Nov 29 '19 20:11 gordonturibamwe

(1) For me,

add this implementation "androidx.multidex:multidex:2.0.0" in your dependencies at android/app/build.gradle file

didn't work.

(2) Also, setting

minSdkVersion 21

would build, but continued to give the same warnings as per the OP

(3) The only thing that got rid of the errors/warnings was to set

minSdkVersion 23

Running flutter pub get was also required.

carlleeswanson avatar Dec 01 '19 02:12 carlleeswanson

None of these changes removed the warning for me. Everyone make sure you do a flutter clean before you declare it resolved for you.

workerbee22 avatar Dec 29 '19 02:12 workerbee22

Setting minSdkVersion 21 and running flutter pub get worked for me. Warning shows only after flutter clean, but on subsequent runs, the warning disappears.

theRoughCode avatar Jan 12 '20 18:01 theRoughCode

minSDK Version update worked...thanks for the solution...waster 3 hours on this :(

manisheasyleases avatar Apr 05 '20 07:04 manisheasyleases

I had the same issue and combined two suggested fixes to get it to finally work:

  1. minSdkVersion 21, change to 23
  2. run "flutter pub upgrade" = issues fixed!

To double-check what the fix was: I also reverted back to 21, and invalidated + flutter clean and the issue appeared again. Then i changed to 23 and the warnings disappeared!

Hey man. I too had the same issues and running pub upgrade solved it. thank, man

praanto avatar May 15 '20 19:05 praanto

Hey all, as part of our on-going work for #2582, this has been resolved in our Firebase Firestore rework (#2913) - which has now been merged into master. We'll look at publishing some prereleases in the next few days. Thank you

Salakar avatar Jul 07 '20 23:07 Salakar