googleads / googleads-mobile-flutter

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

Cannot compile and run app in Android #20

Closed nathanogunleye closed 3 years ago

nathanogunleye commented 3 years ago

Bug report

Describe the bug I can't seem to run my app on Android

Steps to reproduce

Steps to reproduce the behavior:

  1. Add google_mobile_ads to pubspec.yaml
  2. Pull dependencies
  3. Run app for Android

Expected behavior

Should compile normally and run in emulator/device


Additional context

This is the output:

Launching lib/main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/natha/.gradle/caches/transforms-2/files-2.1/d8f12f2ec04b54b1a011f2c65df7b1eb/play-services-ads-lite-19.7.0/AndroidManifest.xml:27:5-43:15: AAPT: error: unexpected element <queries> found in <manifest>.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin firebase_admob...
Running Gradle task 'assembleAarRelease'...
Exception: The plugin firebase_admob could not be built due to the issue above.

I also tried removing firebase_admob be this didn't work:

Launching lib/main.dart on sdk gphone x86 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/natha/.gradle/caches/transforms-2/files-2.1/d8f12f2ec04b54b1a011f2c65df7b1eb/play-services-ads-lite-19.7.0/AndroidManifest.xml:27:5-43:15: AAPT: error: unexpected element <queries> found in <manifest>.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin flutter_plugin_android_lifecycle...
Running Gradle task 'assembleAarRelease'...

FAILURE: Build failed with an exception.

* What went wrong:
Task 'assembleAarRelease' not found in root project 'flutter_plugin_android_lifecycle'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Exception: The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand % flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.2 20D80 darwin-x64, locale en-GB) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS (Xcode 12.4) [!] Android Studio (version 4.1) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [!] IntelliJ IDEA Ultimate Edition (version 2018.3.6) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [✓] VS Code (version 1.52.1) [✓] Connected device (1 available) ! Doctor found issues in 2 categories. natha@NathanOdong london_bus_hunter %

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand % flutter pub deps -- --style=compact Dart SDK 2.10.5 Flutter SDK 1.22.6 london_bus_hunter 0.11.0+202102211 dependencies: - animations 1.1.2 [flutter] - bloc 6.1.0 [meta] - dio 3.0.10 [http_parser path] - equatable 1.2.5 [collection meta] - firebase_admob 0.10.3 [meta flutter firebase_core] - flappy_search_bar 1.7.2 [flutter async flutter_staggered_grid_view] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_bloc 6.1.1 [flutter bloc provider] - flutter_html 1.0.2 [html csslib css_colors video_player chewie webview_flutter chewie_audio flutter_svg flutter] - flutter_widgets 0.1.12 [collection flutter html meta quiver] - fluttertoast 7.1.1 [flutter flutter_web_plugins] - geolocator 5.3.2+2 [flutter meta equatable google_api_availability location_permissions vector_math] - google_fonts 1.1.1 [flutter http path_provider crypto pedantic] - google_maps_flutter 1.0.6 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface] - google_mobile_ads 0.11.0+1 [meta flutter] - http 0.12.2 [http_parser path pedantic] - intl 0.16.1 [path] - json_serializable 3.5.0 [analyzer build build_config json_annotation meta path source_gen] - package_info 0.4.3+2 [flutter] - pagination_view 1.0.3+2 [flutter bloc flutter_bloc] - path 1.8.0-nullsafety.1 - provider 4.3.2+2 [flutter nested collection] - retrofit 1.3.4+1 [meta dio] - settings_ui 0.4.0 [flutter] - shared_preferences 0.5.12+4 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows] - simple_logger 1.7.0 [logging stack_trace] - sliding_up_panel 1.0.2 [flutter] - splashscreen 1.3.5 [flutter] - sqflite 1.3.2+1 [flutter sqflite_common path] - sqflite_common 1.0.2+1 [synchronized path meta] - url_launcher 5.7.10 [flutter url_launcher_platform_interface url_launcher_web url_launcher_linux url_launcher_macos url_launcher_windows] dev dependencies: - build_runner 1.10.4 [args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style glob graphs http_multi_server io js logging meta mime path pedantic pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - flutter_launcher_icons 0.7.5 [image args yaml] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data] - mock_web_server 4.1.1 - retrofit_generator 1.4.0+1 [dio source_gen built_collection code_builder tuple retrofit analyzer dart_style build] - sqflite_common_ffi 1.1.1 [sqlite3 sqflite_common synchronized path meta] transitive dependencies: - _fe_analyzer_shared 12.0.0 [meta] - analyzer 0.40.6 [_fe_analyzer_shared args cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 2.0.13 [crypto args path] - args 1.6.0 - async 2.5.0-nullsafety.1 [collection] - boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner] - build 1.5.0 [analyzer async convert crypto logging meta path glob] - build_config 0.4.2 [checked_yaml json_annotation meta path pubspec_parse yaml] - build_daemon 2.1.4 [built_collection built_value http_multi_server logging pedantic path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 1.4.3 [analyzer build crypto graphs logging meta path package_config pool pub_semver] - build_runner_core 6.0.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pedantic pool timing watcher yaml] - built_collection 4.3.2 [collection quiver] - built_value 7.1.0 [built_collection collection fixnum quiver] - characters 1.1.0-nullsafety.3 - charcode 1.2.0-nullsafety.1 - checked_yaml 1.0.2 [json_annotation source_span yaml] - chewie 0.9.10 [open_iconic_flutter video_player wakelock flutter] - chewie_audio 1.0.0+1 [open_iconic_flutter video_player screen flutter] - cli_util 0.2.0 [path] - clock 1.1.0-nullsafety.1 - code_builder 3.5.0 [built_collection built_value collection matcher meta] - collection 1.15.0-nullsafety.3 - convert 2.1.1 [charcode typed_data] - crypto 2.1.5 [collection convert typed_data] - css_colors 1.0.2 [flutter] - csslib 0.16.2 [source_span] - dart_style 1.3.9 [analyzer args path source_span] - fake_async 1.2.0-nullsafety.1 [clock collection] - ffi 0.1.3 - file 5.2.1 [intl meta path] - firebase_core 0.5.3 [firebase_core_platform_interface flutter quiver meta firebase_core_web] - firebase_core_platform_interface 2.1.0 [flutter meta plugin_platform_interface quiver] - firebase_core_web 0.2.1+1 [firebase_core_platform_interface flutter flutter_web_plugins meta js] - fixnum 0.10.11 - flutter_plugin_android_lifecycle 1.0.11 [flutter] - flutter_staggered_grid_view 0.3.2 [flutter] - flutter_svg 0.18.1 [path_drawing xml vector_math meta flutter] - flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math] - glob 1.2.0 [async collection node_io path pedantic string_scanner] - google_api_availability 2.0.4 [flutter] - google_maps_flutter_platform_interface 1.0.4 [flutter meta plugin_platform_interface stream_transform] - graphs 0.2.0 - html 0.14.0+4 [csslib source_span] - http_multi_server 2.2.0 [async] - http_parser 3.1.4 [charcode collection source_span string_scanner typed_data] - image 2.1.19 [archive xml meta] - io 0.3.4 [charcode meta path string_scanner] - js 0.6.2 - json_annotation 3.1.0 - location_permissions 3.0.0+1 [flutter meta] - logging 0.11.4 - matcher 0.12.10-nullsafety.1 [stack_trace] - meta 1.3.0-nullsafety.3 - mime 0.9.7 - nested 0.0.4 [flutter] - node_interop 1.2.0 [js] - node_io 1.1.1 [node_interop path] - open_iconic_flutter 0.3.0 [flutter] - package_config 1.9.3 [path charcode] - path_drawing 0.4.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.1.4 [vector_math meta] - path_provider 1.6.24 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows] - path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 0.0.4+6 [flutter] - path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface] - path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32] - pedantic 1.9.2 [meta] - petitparser 3.1.0 [meta] - platform 2.2.1 - plugin_platform_interface 1.0.3 [meta] - pool 1.4.0 [async stack_trace] - process 3.0.13 [file intl meta path platform] - pub_semver 1.4.4 [collection] - pubspec_parse 0.1.5 [checked_yaml json_annotation pub_semver yaml] - quiver 2.1.5 [matcher meta] - screen 0.0.5 [flutter] - shared_preferences_linux 0.0.2+4 [file flutter meta path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 0.0.1+11 [shared_preferences_platform_interface flutter] - shared_preferences_platform_interface 1.0.4 [meta flutter] - shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta] - shared_preferences_windows 0.0.1+3 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows] - shelf 0.7.9 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 0.2.3 [shelf web_socket_channel stream_channel] - sky_engine 0.0.99 - source_gen 0.9.8 [analyzer async build dart_style glob meta path pedantic source_span] - source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph] - sqlite3 0.1.8 [collection ffi meta] - stack_trace 1.10.0-nullsafety.1 [path] - stream_channel 2.1.0-nullsafety.1 [async] - stream_transform 1.2.0 - string_scanner 1.1.0-nullsafety.1 [charcode source_span] - synchronized 2.2.0+2 - term_glyph 1.2.0-nullsafety.1 - test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - timing 0.1.1+2 [json_annotation] - tuple 1.0.3 [quiver] - typed_data 1.3.0-nullsafety.3 [collection] - url_launcher_linux 0.0.1+4 [flutter] - url_launcher_macos 0.0.1+9 [flutter] - url_launcher_platform_interface 1.0.9 [flutter meta plugin_platform_interface] - url_launcher_web 0.1.5+1 [url_launcher_platform_interface flutter flutter_web_plugins meta] - url_launcher_windows 0.0.1+3 [flutter] - vector_math 2.1.0-nullsafety.3 - video_player 0.10.12+5 [meta video_player_platform_interface video_player_web flutter] - video_player_platform_interface 2.2.0 [flutter meta] - video_player_web 0.1.4+1 [flutter flutter_web_plugins meta video_player_platform_interface] - wakelock 0.1.4+2 [flutter] - watcher 0.9.7+15 [async path pedantic] - web_socket_channel 1.1.0 [async crypto stream_channel] - webview_flutter 0.3.24 [flutter] - win32 1.7.4 [ffi] - xdg_directories 0.1.2 [meta path process] - xml 4.5.1 [collection convert meta petitparser] - yaml 2.2.1 [charcode collection string_scanner source_span]

blasten commented 3 years ago

You would need to upgrade the version of the Android Gradle plugin as described on this blog post.

Flutter upgraded to 4.1, so if you don't have special code in the android directory, you could delete it, and run flutter create . within the app directory. That is sufficient to resolve this issue.

nathanogunleye commented 3 years ago

@blasten Thanks, I needed to upgrade from version 3.5.0 to 4.1.2. Closing the issue.