Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MobileAds.instance.setAppVolume causes a Non-fatal Exception #369

Closed
victorgoh opened this issue Sep 10, 2021 · 1 comment · Fixed by #392
Closed

MobileAds.instance.setAppVolume causes a Non-fatal Exception #369

victorgoh opened this issue Sep 10, 2021 · 1 comment · Fixed by #392
Assignees
Labels
bug Something isn't working e2-days Effort: < 5 days fixed Issue has been resolved and pull request linked p3-low

Comments

@victorgoh
Copy link

victorgoh commented Sep 10, 2021

MobileAds.instance.setAppVolume(0.1);

will trigger the following exception:

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, java.lang.Double cannot be cast to java.lang.Float, null, java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float
	at io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin.onMethodCall(Unknown Source:534)

Plugin Version

0.13.4

Steps to Reproduce

Use the following code in a flutter app

MobileAds.instance.setAppVolume(0.1);

Expected results:
Interstitial Ads volume reduced.

Actual results:
No change in ads volume.

Logs

flutter run --verbose

[  +10 ms] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393): Failed to handle method call
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393): java.lang.ClassCastException: java.lang.Double cannot be cast to
java.lang.Float
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at
io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin.onMethodCall(GoogleMobileAdsPlugin.java:399)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at
io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at
io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at
io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at android.os.MessageQueue.nativePollOnce(Native Method)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at android.os.MessageQueue.next(MessageQueue.java:336)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at android.os.Looper.loop(Looper.java:174)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at android.app.ActivityThread.main(ActivityThread.java:7356)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at java.lang.reflect.Method.invoke(Native Method)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
[        ] E/MethodChannel#plugins.flutter.io/google_mobile_ads(24393):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
flutter doctor -v

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale en-US)
    • Flutter version 2.2.3 at /Users/victorgoh/Tools/flutter
    • Framework revision f4abaa0735 (2 months ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/victorgoh/Tools/android-sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/victorgoh/Tools/android-sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] VS Code (version 1.60.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • macOS (desktop)                    • macos         • darwin-x64     • macOS 11.5.2 20G95 darwin-x64
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 93.0.4577.63

• No issues found!

@maheshj01 maheshj01 added the in triage Issue currently being evaluated label Sep 10, 2021
@maheshj01
Copy link
Collaborator

Hi @victorgoh, Thanks for filing the issue. I can replicate the issue on the latest stable 2.5.0 with google_mobile_Ads ads plugin 0.13.4 the volume is not getting changed however muted works. The issue is reproducible on both IOS and Android.

MobileAds.instance.setAppVolume(0.1);  /// does not work
 MobileAds.instance.setAppMuted(true);  // works
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-arm, locale en-GB)
    • Flutter version 2.5.0 at /Users/mahesh/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (2 days ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/mahesh/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/mahesh/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Community Edition (version 2021.2.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 60.1.4
    • Dart plugin version 212.5080.8

[✓] VS Code (version 1.59.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.26.0

[✓] Connected device (3 available)
    • iPhone 12 Pro (mobile) • B622CBB7-F906-4FA7-8F49-FACEAAC905AB • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 11.5.2 20G95 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 93.0.4577.63

• No issues found!

@maheshj01 maheshj01 added bug Something isn't working e2-days Effort: < 5 days p3-low and removed in triage Issue currently being evaluated labels Sep 10, 2021
srichakradhar added a commit to srichakradhar/googleads-mobile-flutter that referenced this issue Sep 27, 2021
srichakradhar added a commit to srichakradhar/googleads-mobile-flutter that referenced this issue Sep 29, 2021
jjliu15 pushed a commit that referenced this issue Sep 30, 2021
* Fix issue 369 - setAppVolume

* Update CHANGELOG.md

Add fix for #369
@maheshj01 maheshj01 added the fixed Issue has been resolved and pull request linked label Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment