googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
344 stars 287 forks source link

Ads issues on Arabic Language from phone setting #651

Closed Panacea-Soft closed 2 years ago

Panacea-Soft commented 2 years ago

We are using the latest google_mobile_ads 2.0.1 for flutter app development. It is ok for phone language is English but it is not working for phone language is Arabic so I would like to explain more details at below :

So, I hope that to fix that issue at next version update.

Cheers, Han

huycozy commented 2 years ago

Hi @Panacea-Soft, please provide a completed and minimal reproducible code sample so that we may verify this. Also, please provide the output of flutter doctor -v as well. Thank you!

Panacea-Soft commented 2 years ago

Hi @Panacea-Soft, please provide a completed and minimal reproducible code sample so that we may verify this. Also, please provide the output of flutter doctor -v as well. Thank you!

Please take a look at here for the sample project : https://drive.google.com/file/d/138uaZ7fdLzH217yha4UfnqGyDVY7nYsK/view?usp=sharing

Here is our testing video : https://drive.google.com/file/d/1wsMGfCc4wwr15s-YE4j9R8MyzDDjRhkg/view?usp=sharing

When you test please make sure for your phone and app need to be Arabic language.

Cheers!

huycozy commented 2 years ago

Hi @Panacea-Soft, thanks for providing the sample code. This issue is reproducible on the latest stable and master Flutter channels. Plugin version: google_mobile_ads: ^2.0.1

Steps to reproduce

  1. Changing the device language to Arabic
  2. Run app (OP's sample code) and click on Change to Arabic button
  3. Click on ..click area (gray area).

Actual result

It opens ads (redirects to store or web page for example) The issue is only happening on Android. On iOS, it works as expected.

Demo (from OP's sample code)

✅: No Issue ❌: Issue reproduced

Video demo - Android: https://user-images.githubusercontent.com/104349824/191074951-069077c4-5615-4956-88a5-4cb71dcf4b42.mov - iOS: https://user-images.githubusercontent.com/104349824/191086940-faf55fd9-466e-498e-b501-d7247d49b115.mov

Could you verify on iOS and confirm the same behavior?


I also tried creating a pure Flutter sample code (without ads) to check that when changing the language to Arabic, the click areas are not disturbed. And it works as intended (The click areas work properly and are not disturbed).

Demo (pure Flutter - no ads) https://user-images.githubusercontent.com/104349824/191075901-ac69523f-5e17-45aa-a11c-65b4103f6c38.mov
flutter doctor -v ```bash [✓] Flutter (Channel stable, 3.3.2, on macOS 12.5.1 21G83 darwin-x64, locale en-VN) • Flutter version 3.3.2 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision e3c29ec00c (12 hours ago), 2022-09-14 08:46:55 -0500 • Engine revision a4ff2c53d8 • Dart version 2.18.1 • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13E113 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2022.1.1) • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app • 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 [✓] VS Code (version 1.71.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.48.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 12.5.1 21G83 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ``` ```bash [✓] Flutter (Channel master, 3.4.0-19.0.pre.337, on macOS 12.5.1 21G83 darwin-x64, locale en-VN) • Flutter version 3.4.0-19.0.pre.337 on channel master at /Users/huynq/Documents/GitHub/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 085a187e04 (75 minutes ago), 2022-09-18 21:11:34 -0400 • Engine revision b22a795011 • Dart version 2.19.0 (build 2.19.0-214.0.dev) • DevTools version 2.17.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13E113 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2022.1.1) • IntelliJ at /Users/huynq/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5591.52/IntelliJ IDEA CE.app • 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 [✓] VS Code (version 1.71.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.48.0 [✓] Connected device (3 available) • SM T225 (mobile) • R9JT3004VRJ • android-arm64 • Android 12 (API 31) • macOS (desktop) • macos • darwin-x64 • macOS 12.5.1 21G83 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.125 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
Panacea-Soft commented 2 years ago

Hi,

Yes it is working on iOS : https://drive.google.com/file/d/1unTaADzb7ir-waS95bTs0YpjcSBjdJsM/view?usp=sharing But it is not working on Android : https://drive.google.com/file/d/1_KWT837I_1lv0VzYvtiNuOOl7Pv4u9Xh/view?usp=sharing

Here is our flutter doctor -v

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.2.1 21D62 darwin-x64, locale en-GB)
    • Flutter version 3.0.5 at /Users/pspanaceasoft/Library/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (10 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/pspanaceasoft/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run path/to/sdkmanager --install "cmdline-tools;latest"
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run flutter doctor --android-licenses to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 4.1)
    • 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 1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (3 available)
    • iPhone 12 Pro Max (mobile) • 5CC895BF-3C25-4B5F-9A98-B3E67B790773 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

If you need anything then please let me know.

Cheers, Han

huycozy commented 2 years ago

@Panacea-Soft I try testing again with a minimal sample code as below (without using 3rd plugins) and see that the issue is not reproducible anymore on Android.

Demo https://user-images.githubusercontent.com/104349824/191460642-7b46966d-fe11-4022-a7e1-531e2724b9b4.mov
Sample code - Use `flutter_localizations` on `pubspec.yaml`: ```yaml flutter_localizations: sdk: flutter ``` - Dart code: ```dart import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); MobileAds.instance..initialize()..updateRequestConfiguration( RequestConfiguration( testDeviceIds: [ ], ) ); runApp(const MyApp()); } class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override State createState() => _MyAppState(); } class _MyAppState extends State { Locale _locale = Locale('en'); void changeLanguage(Locale locale) { setState(() { _locale = locale; }); } @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), localizationsDelegates: const [ GlobalCupertinoLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ], supportedLocales: const [ Locale("en", "US"), Locale('ar', 'AE'), ], locale: _locale, home: Scaffold( appBar: AppBar( title: const Text('Admob Testing'), ), body: Column( children: [ SizedBox( height: 350, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ InkWell( onTap: () { Fluttertoast.showToast( msg: 'This is a toast.', toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.BOTTOM, timeInSecForIosWeb: 1, backgroundColor: Colors.blueGrey, textColor: Colors.white); }, child: Container( height: double.infinity, width: 180, color: Colors.grey[400], child: const Center(child: Text('click..')), ), ), const PsAdMobNativeWidget(), ], ), ), const SizedBox( height: 10, ), TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.blue), foregroundColor: MaterialStateProperty.all(Colors.white) ), child: Text( 'Change to Arabic', style: TextStyle(fontSize: 20.0)), onPressed: () { changeLanguage(Locale('ar')); }, ) ], ), ), ); } } class PsAdMobNativeWidget extends StatefulWidget { const PsAdMobNativeWidget({ Key? key, }) : super(key: key); @override State createState() => _PsAdMobNativeWidgetState(); } class _PsAdMobNativeWidgetState extends State { NativeAd? _nativeAd; bool _nativeAdIsLoaded = false; static String androidAdMobNativeAdUnitId = 'ca-app-pub-3940256099942544/2247696110'; @override void didChangeDependencies() { super.didChangeDependencies(); _nativeAd = NativeAd( adUnitId: androidAdMobNativeAdUnitId, request: const AdRequest(), factoryId: Platform.isAndroid ? 'adFactoryExample' : 'adFactoryExample', listener: NativeAdListener( onAdLoaded: (Ad ad) { print('$NativeAd loaded.'); setState(() { _nativeAdIsLoaded = true; }); }, onAdFailedToLoad: (Ad ad, LoadAdError error) { print('$NativeAd failedToLoad: $error'); ad.dispose(); }, onAdOpened: (Ad ad) => print('$NativeAd onAdOpened.'), onAdClosed: (Ad ad) => print('$NativeAd onAdClosed.'), ), )..load(); } @override void dispose() { super.dispose(); _nativeAd?.dispose(); } @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.only( left: 4, right: 4, bottom: 12), decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(8)), ), width: 180, child: _nativeAdIsLoaded ? AdWidget(ad: _nativeAd!) : const Text('Loading Ads')); } } ```

The issue may come from easy_localization. Please try removing it from your project and confirm.

Panacea-Soft commented 2 years ago

@Panacea-Soft I try testing again with a minimal sample code as below (without using 3rd plugins) and see that the issue is not reproducible anymore on Android.

Demo Sample code The issue may come from easy_localization. Please try removing it from your project and confirm.

When we try according to your suggestion like this photo_2022-09-23 14 56 29

There is the issue. You can take a look our full source code at here also : https://drive.google.com/file/d/17yYh-usNbWzBW_0lNd1yRVqKNgV3jKhs/view?usp=sharing

Cheers, Han

huycozy commented 2 years ago

Hi @Panacea-Soft

There is the issue

Do you confirm the issue caused by easy_localization?

Panacea-Soft commented 2 years ago

Hi @Panacea-Soft

There is the issue

Do you confirm the issue caused by easy_localization?

When we not using easy_localization it is still remain the issue. So I don't think it is come from easy_localization. You can take a look at our sharing code also.

huycozy commented 2 years ago

@Panacea-Soft I remove flutter_braintree from your provided code in https://github.com/googleads/googleads-mobile-flutter/issues/651#issuecomment-1255935796 and see the issue doesn't happen. Please try this from your side and confirm the same behavior.

Panacea-Soft commented 2 years ago

@Panacea-Soft I remove flutter_braintree from your provided code in #651 (comment) and see the issue doesn't happen. Please try this from your side and confirm the same behavior.

When remove flutter_braintree then it is ok but our project need to use that module for paypal payment integration. So, it is not ok to remove it. Is there any others solution?

huycozy commented 2 years ago

@Panacea-Soft It is related to a 3rd party plugin rather than to Flutter/googleads-mobile-flutter itself. Please open the issue in the dedicated repository for further support there. I feel safe to close this issue from here, if you disagree please write in the comments and I will reopen it. Thank you!