firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

[firebase_admob] AdRequestBuilderFactory.java uses or overrides a deprecated API #438

Closed kroikie closed 3 years ago

kroikie commented 5 years ago

getting this error.

Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.8.0+1\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
kroikie commented 5 years ago

@IAmHasanHabib

The issue at https://github.com/flutter/flutter/issues/28025 has been closed and moved here. Future collaboration on this issue will be done here.

iapicca commented 5 years ago

Hi @IAmHasanHabib (and hello to @MatiDeve , @eladcandroid , @Sheharyar566, @heinzan and @Row7) If are you still experiencing this issue with the latest version of Flutter and FlutterFire plugin can you please provide your flutter doctor -v and your and your flutter run --verbose/flutter build --verbose ? Also, to better address the issue, would be helpful if you could post a self contained app on github or the steps to reproduce it. Thank you

BondarenkoStas commented 4 years ago

Basing on https://github.com/FirebaseExtended/flutterfire/issues/179, reported while using firebase_admob: ^0.9.0+7 which is the current version. As the version is released on August and the repo contains no changes for 2 month, I believe the issue is still present.

daneed commented 4 years ago

Is it still an existing issue? I always get this error. And I think, the deprecated API is the Google Developer API 1 or 2, and Google Play Store always complains about this. https://android-developers.googleblog.com/2019/03/changes-to-google-play-developer-api.html. 1st december is tomorrow.

redabelca commented 4 years ago

is it fixed yet, i get same error?

olga0 commented 4 years ago

I have the same issue with version 0.9.0+7. Flutter doctor:

[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 10.0.18362.476], locale en-US)
    β€’ Flutter version 1.9.1+hotfix.6 at C:\Users\olgam\source\flutter
    β€’ Framework revision 68587a0916 (3 months ago), 2019-09-13 19:46:58 -0700
    β€’ Engine revision b863200c37
    β€’ Dart version 2.5.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    β€’ Android SDK at C:\Users\olgam\AppData\Local\Android\sdk
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-28, build-tools 28.0.3
    β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    β€’ All Android licenses accepted.

[√] Android Studio (version 3.5)
    β€’ Android Studio at C:\Program Files\Android\Android Studio
    β€’ Flutter plugin version 42.0.1
    β€’ Dart plugin version 191.8593
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] Connected device (1 available)
    β€’ Android SDK built for x86 β€’ emulator-5554 β€’ android-x86 β€’ Android 8.1.0 (API 27) (emulator)

β€’ No issues found!
sheiksoftware commented 4 years ago

Is this Issue fixed ? I am getting the same problem while building the appbundle. I am using the Firebase_admob and in_app_purchase latest versions. Please find the details below:

Error:


C:\Users\sibrahim\AndroidStudioProjects\amsome_calc>flutter build appbundle Note: C:\Users\sibrahim\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.9.0+10\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\Users\sibrahim\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\in_app_purchase-0.2.2+4\android\src\main\java\io\flutter\plugins\inapppurchase\InAppPurchasePlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\Users\sibrahim\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\in_app_purchase-0.2.2+4\android\src\main\java\io\flutter\plugins\inapppurchase\MethodCallHandlerImpl.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Versions:


firebase_admob: ^0.9.0+10 in_app_purchase: ^0.2.2+4

Flutter Doctor -v:


[√] Flutter (Channel beta, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.17134.1184], locale en-US) β€’ Flutter version 1.12.13+hotfix.6 at C:\flutter β€’ Framework revision 18cd7a3601 (2 weeks ago), 2019-12-11 06:35:39 -0800 β€’ Engine revision 2994f7e1e6 β€’ Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) β€’ Android SDK at C:\Users\sibrahim\AppData\Local\Android\sdk β€’ Android NDK location not configured (optional; useful for native profiling support) β€’ Platform android-28, build-tools 28.0.3 β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java β€’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) β€’ All Android licenses accepted.

[√] Android Studio (version 3.5) β€’ Android Studio at C:\Program Files\Android\Android Studio β€’ Flutter plugin version 39.0.3 β€’ Dart plugin version 191.8423 β€’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[!] Connected device ! No devices available

erperejildo commented 4 years ago

Any update on this issue? Still getting it

jahidanowar commented 4 years ago

Still Getting the issue any update ?

egyleader commented 4 years ago

me also getting this error :

Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+1\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

my flutter doctor -v :

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.17763.1098], locale en-US) β€’ Flutter version 1.12.13+hotfix.8 at C:\flutter β€’ Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800 β€’ Engine revision e1e6ced81d β€’ Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) β€’ Android SDK at C:\Users\Egyleader\AppData\Local\Android\sdk β€’ Android NDK location not configured (optional; useful for native profiling support) β€’ Platform android-29, build-tools 28.0.3 β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java β€’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) β€’ All Android licenses accepted.

[√] Android Studio (version 3.5) β€’ Android Studio at C:\Program Files\Android\Android Studio β€’ Flutter plugin version 42.1.1 β€’ Dart plugin version 191.8593 β€’ Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code, 64-bit edition (version 1.43.2) β€’ VS Code at C:\Program Files\Microsoft VS Code β€’ Flutter extension version 3.8.1

[√] Connected device (1 available) β€’ AOSP on IA Emulator β€’ emulator-5554 β€’ android-x86 β€’ Android 9 (API 28) (emulator)

β€’ No issues found!

walidbagh commented 4 years ago

Same issue: Note: E:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+1\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [version 6.1.7601], locale fr-FR)
    β€’ Flutter version 1.12.13+hotfix.8 at E:\flutter
    β€’ Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800
    β€’ Engine revision e1e6ced81d
    β€’ Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    β€’ Android SDK at E:/Android/Sdk
    β€’ Android NDK location not configured (optional; useful for native profiling support)
    β€’ Platform android-29, build-tools 29.0.3
    β€’ ANDROID_HOME = E:/Android/Sdk
    β€’ Java binary at: E:\Program Files\Java\jdk1.8.0_241\bin\java
    β€’ Java version Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
    β€’ All Android licenses accepted.

[!] Android Studio (version 3.6)
    β€’ Android Studio at E:\Program Files\Android\Android Studio
    β€’ Flutter plugin version 44.0.2
    β€’ Dart plugin version 192.7761
    X Unable to find bundled Java version.
    β€’ Try updating or re-installing Android Studio.

[!] VS Code (version 1.40.2)
    β€’ VS Code at C:\Users\walid\AppData\Local\Programs\Microsoft VS Code
    X Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (1 available)
    β€’ Android SDK built for x86 β€’ emulator-5554 β€’ android-x86 β€’ Android 10 (API 29) (emulator)

! Doctor found issues in 2 categories.
hashaaan commented 4 years ago

+1 Same issue here

MatheusXavier commented 4 years ago

I'm having the same problem

Bronz0 commented 4 years ago

I am getting the same error

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [version 10.0.17763.1039], locale fr-FR)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 3.5) [√] VS Code (version 1.43.2) [√] Connected device (1 available)

mehmetyilmaz001 commented 4 years ago

I am also facing with this error :(

domizilver commented 4 years ago

same error aswell

kcprabase commented 4 years ago

Same issue with me as well:

PS D:\Source\Workspaces> flutter run Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on Android SDK built for x86 in debug mode... Note: D:\flutter.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+2\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

PS D:\Source\Workspaces> flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18362.778], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [!] Android Studio (not installed) [√] Connected device (1 available)

! Doctor found issues in 1 category.

MadsonAlan commented 4 years ago

I was able to solve the problem using firebase_admob 0.9.3+2 with these settings: in project / build.gradle

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

and in app / build.gradle

//
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
}
//
gentlejo commented 4 years ago

In my case, my app was in a crash on launch. I missed including ADMOB_APP_ID to AndroidMenifest.xml. Then the issue was fixed.

kcprabase commented 4 years ago

In my case, my app was in a crash on launch. I missed including ADMOB_APP_ID to AndroidMenifest.xml. Then the issue was fixed.

Mine is the similar case. I took ADMOB_APP_ID from strings.xml and I had a little typo that was causing all the problem. @gentlejo 's comment helped to consider rechecking on that spot. `

    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="@string/admob_app_id"/>`
vn1miguel commented 4 years ago

using firebase_admob: ^0.9.3+2, I just did: - update android\build.gradle

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()
    }

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

- add google-services.json to android\app folder

- update android\app\build.gradle file

android {
    compileSdkVersion 29

    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.vdevcode.familiabolson"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    ...
    ...
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

apply plugin: 'com.google.gms.google-services'`

update gradle on android\gradle\wrapper\gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

kayvij commented 4 years ago

Just wanted to mention that this issue appears only after migrating to AndroidX...

I am using firebase_admob: ^0.9.3+2

richtea99 commented 4 years ago

I've shortened the output for readabilty, but here are the 4 individual calls that are deprecated, with line numbers: pub.dartlang.org\firebase_admob-0.9.3+2\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory: AdRequestBuilderFactory.java:93: warning: [deprecation] setBirthday(Date) in Builder has been deprecated AdRequestBuilderFactory.java:102: warning: [deprecation] setGender(int) in Builder has been deprecated AdRequestBuilderFactory.java:111: warning: [deprecation] setIsDesignedForFamilies(boolean) in Builder has been deprecated AdRequestBuilderFactory.java:115: warning: [deprecation] tagForChildDirectedTreatment(boolean) in Builder has been deprecated

The pub.dev Readme references some of these too, so that may need revising. Small extract from the readme page: MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo( keywords: ['flutterio', 'beautiful apps'], contentUrl: 'https://flutter.io', birthday: DateTime.now(), childDirected: false, designedForFamilies: false, gender: MobileAdGender.male, // or MobileAdGender.female, MobileAdGender.unknown testDevices: [], // Android emulators are considered test devices ); I'm happy to add extra info if needed.

bdlukaa commented 4 years ago
Note: C:\Users\bruno\Documents\flutter sdk\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+2\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

C:\Users\bruno\Documents\flutter sdk\.pub-cache\hosted\pub.dartlang.org\flutter_native_admob-2.1.0\android\src\main\kotlin\com\nover\flutternativeadmob\FlutterNativeAdmobPlugin.kt:74:5: warning: parameter 'id' is never used
    id: Int,
    ^

C:\Users\bruno\Documents\flutter sdk\.pub-cache\hosted\pub.dartlang.org\flutter_native_admob-2.1.0\android\src\main\kotlin\com\nover\flutternativeadmob\FlutterNativeAdmobPlugin.kt:91:45: warning: name shadowed: id
    (map["controllerID"] as? String)?.let { id ->

Mine are showing the same error plus these warnings

TharinduKetipe commented 4 years ago

Hi ! Did you fix this issue? I also getting that. I'm using firebase_admob: ^0.9.3+2. I also getting following warning

Note: C:\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.8.0+1\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I have tried this with using completely new flutter project as well. I'm still getting this issue. When I enter the flutter run It will stuck in βœ“ Built build/app/outputs/flutter-apk/app-debug.apk. step and no further processing. Following is my terminal output

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Qualitappss-MacBook-Air:KathaSayura tharinduketipearachchi$ flutter run
Using hardware rendering with device sdk gphone x86. If you get graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on sdk gphone x86 in debug mode...
Plugin project :firebase_core_web not found. Please update settings.gradle.
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        11.1s
βœ“ Built build/app/outputs/flutter-apk/app-debug.apk.

Can anyone help me this? Because I can't able to upload my application to playstore without this. Since almost for a week I'm stuck in this issue.

richtea99 commented 4 years ago

Still getting it. I've chosen to ignore it, since we're not using those calls. We're a day or two from uploading, so I'll let you know if I'm blocked from doing that.

TharinduKetipe commented 4 years ago

@richtea99 Thing is for me It is stuck at the build phase. I can't run the project and there is no way further.

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Qualitappss-MacBook-Air:KathaSayura tharinduketipearachchi$ flutter run
Using hardware rendering with device sdk gphone x86. If you get graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on sdk gphone x86 in debug mode...
Plugin project :firebase_core_web not found. Please update settings.gradle.
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        11.1s
βœ“ Built build/app/outputs/flutter-apk/app-debug.apk.

flutter run isn't going beyond this

richtea99 commented 4 years ago

There's no error or crash in your output, so I'm not sure the failure to run is related to the deprecations. There is a mention of this in the thread above, but it's a long shot for you: 'I missed including ADMOB_APP_ID to AndroidMenifest.xml. Then the issue was fixed.'

TharinduKetipe commented 4 years ago

I have added ADMOB_APP_ID to manfiset. I have checked it so many times

TharinduKetipe commented 4 years ago

Hi @richtea99 @vn1miguel Any update on this. I still wasn't able to fix this. :( Since I can't debug or run the application, I have build an apk using flutter build apk --split-per-abicommand and installed it. Application crashes on startup. Anyway I only have android emulator. Is that a problem? Do we need to run the application on actual device? Here I have attached the information about my emulator. I being trying to fix this thing for 2 weeks now. But still couldn't get this work :(

Screenshot 2020-05-31 at 02 05 08

Following is my Manifest File

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.tharindu.kathandara_potha">
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="kathandara_potha"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
             <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxx"/>
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK" />
            <category android:name="android.intent.category.DEFAULT" />
            </intent-filter> 
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Here is my pubspec.yaml

name: kathandara_potha
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  firebase_core: ^0.4.0+9
  firebase_database: ^3.1.5
  firebase_messaging: ^6.0.15
  firebase_admob: ^0.9.3+2

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Your any kind of help is really appreciated. I absolutely don't have any clew about this issues :(

richtea99 commented 4 years ago

Hello TharinduKetipe, I don't think your problem is related to deprecated APIs, so I think posting here isn't helpful for other users at this point. I think you need to go back a step. The fact is that your APK built OK even with deprecations. You need to look for the errors coming back when you run that APK. If that doesn't help then I recommend posting to SO with code snippets and the errors. However, if do find something related to the deprecation, then do come back and update us here.

dhananjaysahu79 commented 4 years ago

App debug is working fine with this error but not app-release :(

TharinduKetipe commented 4 years ago

Hi! @richtea99 After the 2 weeks fighting I was able to find the issue. When you add Admob app Id on met-data tag in android manifest file,

 <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="xxxxxx"/>

you should add it right after the <application> tag, and before the Main Activity tag

<activity
            android:name=".MainActivity" 

as follows,

<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="xxx"
        android:icon="@mipmap/ic_launcher">

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-xxxxxxx"/> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">



Earlier I was adding `APPLICATION_ID` meta tag after the `MainActivity` tag, That was exactly caused for this issue.
richtea99 commented 4 years ago

Yup, looks good. The order doesn't matter in XML, but which tag you place the APPLICATION_ID in does. Looking back at your previous XML (30th May), you had it embedded inside an \<activity> tab (wrong!), whereas it should be inside the \<application> tag (correct!). Glad to hear it's fixed.

TharinduKetipe commented 4 years ago

@richtea99 Yeah, Since I'm a native iOS developer, didn't know much about android configurations. Thank you very much for the support given :)

dn32 commented 4 years ago

Hi! @richtea99 After the 2 weeks fighting I was able to find the issue. When you add Admob app Id on met-data tag in android manifest file,

 <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="xxxxxx"/>

you should add it right after the <application> tag, and before the Main Activity tag

<activity
            android:name=".MainActivity" 

as follows,

<application
       android:name="io.flutter.app.FlutterApplication"
       android:label="xxx"
       android:icon="@mipmap/ic_launcher">

<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-xxxxxxx"/> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">



Earlier I was adding `APPLICATION_ID` meta tag after the `MainActivity` tag, That was exactly caused for this issue.

I spent a long time until I found an answer in your post. Thank you infinitely!

affankhan43 commented 4 years ago
<application
        android:name="io.flutter.app.FlutterApplication"
        android:label="xxx"
        android:icon="@mipmap/ic_launcher">
        <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxx"/>
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

Still facing same issue

yatta0622 commented 4 years ago

Did you get the Admob App ID from "App Settings"? Not an "ad unit".I once misunderstood.

hygornet commented 4 years ago

Ainda ocorre comigo o mesmo problema. AlguΓ©m pode me ajudar?

yourshinsuke commented 4 years ago

when will you fix? MethodCallHandlerImpl.java is deprecated also

cielio commented 4 years ago

Faça o projeto em https://console.firebase.google.com/ e adicione no seu app e fica tudo normal... https://youtu.be/PxYiLDuS3hk

daybson commented 4 years ago

Same issue / mesmo problema: App works fine on emulator/debug mode, but the release apk crashes on physical device.

[√] Flutter (Channel stable, 1.20.4, on Microsoft Windows [versão 10.0.19041.508], locale pt-BR) β€’ Flutter version 1.20.4 at C:\src\flutter β€’ Framework revision fba99f6cf9 (10 days ago), 2020-09-14 15:32:52 -0700 β€’ Engine revision d1bc06f032 β€’ Dart version 2.9.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) β€’ Android SDK at C:\Users\myuser\AppData\Local\Android\sdk β€’ Platform android-30, build-tools 30.0.2 β€’ Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) β€’ All Android licenses accepted.

[√] Android Studio (version 4.0) β€’ Android Studio at C:\Program Files\Android\Android Studio β€’ Flutter plugin version 49.0.2 β€’ Dart plugin version 193.7547 β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code, 64-bit edition (version 1.49.1) β€’ VS Code at C:\Program Files\Microsoft VS Code β€’ Flutter extension version 3.14.1

[√] Connected device (1 available) β€’ Moto G 5S Plus (mobile) β€’ 0040665429 β€’ android-arm β€’ Android 8.1.0 (API 27)

β€’ No issues found!


dependencies: flutter: sdk: flutter sqflite_sqlcipher: ^1.1.1 path: ^1.7.0 path_provider: ^1.6.18 path_provider_macos: ^0.0.4+4 url_launcher: ^5.7.1 package_info: ^0.4.3 shared_preferences: ^0.5.12 flutter_screenutil: ^3.0.2 launch_review: ^2.0.0 provider: get: ^3.11.1 image_picker: ^0.6.7+11 firebase_admob: ^0.9.3+4

C:\Users\myuser\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+4\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

daybson commented 4 years ago

dependencies: flutter: sdk: flutter sqflite_sqlcipher: ^1.1.1 path: ^1.7.0 path_provider: ^1.6.18 path_provider_macos: ^0.0.4+4 url_launcher: ^5.7.1 package_info: ^0.4.3 shared_preferences: ^0.5.12 flutter_screenutil: ^3.0.2 launch_review: ^2.0.0 provider: get: ^3.11.1 image_picker: ^0.6.7+11 firebase_admob: ^0.9.3+4

C:\Users\myuser\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_admob-0.9.3+4\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuilderFactory.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

This link helped me: https://support.backendless.com/t/release-app-crash/10632/33 When I change the minifyEnabled true to minifyEnabled false, it worked.

So I figured out that was caused by sqflite_sqlcipher, and adding a file "android/app/proguard-rules.pro" with "-keep class net.sqlcipher.** { *; }" was need.

"Flutter now enables code shrinking by default when building an APK in release mode, so you need to add the following ProGuard rules to the file android/app/proguard-rules.pro. If it does not exist, create it:" https://pub.dev/packages/sqflite_sqlcipher

Now, with the proguard file and minifyEnabled and shrinkResources back to true, is working fine again.

russellwheatley commented 3 years ago

The firebase_admob plugin will be deprecated in April 2021 in favor of Google Mobile Ads SDK for Flutter. Google Mobile Ads SDK for Flutter is a new Flutter plugin that supports more Ads formats than firebase_admob does. Google Mobile Ads SDK for Flutter currently supports loading and displaying banner, interstitial (full-screen), native ads, and rewarded video ads across AdMob and AdManager. It also supports displaying banner and native ads as Widgets as opposed to being overlayed over all app content. We're now recommending projects currently using firebase_admob migrate to Google Mobile Ads SDK for Flutter following the instructions outlined here. Issues with migrating or with using the new package should now be raised over on the Google Mobile Ads SDK for Flutter repository.