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

Example application not compiling #39

Open
mg7237 opened this issue Oct 27, 2020 · 1 comment
Open

Example application not compiling #39

mg7237 opened this issue Oct 27, 2020 · 1 comment

Comments

@mg7237
Copy link

mg7237 commented Oct 27, 2020

Issues: exmple code provided on the pub dev site is not getting compiled. Details below:

Steps to Reproduce

  1. Create new flutter application. Replace main.dart content with the example code.
  2. Compile/Run the application (using Android studio).
    Note: URL for example code: https://pub.dev/packages/flutter_pdf_viewer/example

Logs

Running Gradle task 'assembleDebug'...
/Users/manishgupta/AndroidStudioProjects/flutter_app_example/android/app/src/debug/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:flutter_pdf_viewer] /Users/manishgupta/AndroidStudioProjects/flutter_app_example/build/flutter_pdf_viewer/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="com.pycampers.flutterpdfviewer" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:flutter_pdf_viewer] /Users/manishgupta/AndroidStudioProjects/flutter_app_example/build/flutter_pdf_viewer/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="com.pycampers.flutterpdfviewer" to force usage (may lead to runtime failures)

  • 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 39s
Exception: Gradle task assembleDebug failed with exit code 1

Flutter doctor:

Flutter (Channel master, 1.24.0-4.0.pre.82, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-IN)
• Flutter version 1.24.0-4.0.pre.82 at /Users/manishgupta/StudioProjects/flutter
• Framework revision e5814756a2 (3 hours ago), 2020-10-27 01:47:03 -0700
• Engine revision 1857470267
• Dart version 2.11.0 (build 2.11.0-260.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/manishgupta/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Dev Tools/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.7, Build version 11E801a
• CocoaPods version 1.9.1

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Dev Tools/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-6222593)

[✓] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

@mg7237
Copy link
Author

mg7237 commented Oct 28, 2020

After updating minSDK to 19. Now the app compiles however it is giving run time error which trying to run on Android simulator. Below if the error log.


Running "flutter pub get" in flutter_app_example...
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Waiting for Android SDK built for x86 to report its views...
Debug service listening on ws://127.0.0.1:50073/x5PM3IpmBSA=/ws
Syncing files to device Android SDK built for x86...
E/flutter (16700): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
E/flutter (16700): If you're running an application and need to access the binary messenger before runApp() has been called (for example, during plugin initialization), then you need to explicitly call the WidgetsFlutterBinding.ensureInitialized() first.
E/flutter (16700): If you're running a test, you can call the TestWidgetsFlutterBinding.ensureInitialized() as the first line in your test's main() method to initialize the binding.
E/flutter (16700): #0 defaultBinaryMessenger. (package:flutter/src/services/binary_messenger.dart:97:7)
E/flutter (16700): #1 defaultBinaryMessenger (package:flutter/src/services/binary_messenger.dart:110:4)
E/flutter (16700): #2 MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:143:62)
E/flutter (16700): #3 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:149:36)
E/flutter (16700): #4 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12)
E/flutter (16700): #5 PdfViewer.enableAnalytics (package:flutter_pdf_viewer/flutter_pdf_viewer.dart:214:19)
E/flutter (16700): #6 main (package:flutter_app_example/main.dart:204:19)
E/flutter (16700): #7 _runMainZoned.. (dart:ui/hooks.dart:136:25)
E/flutter (16700): #8 _rootRun (dart:async/zone.dart:1190:13)
E/flutter (16700): #9 _CustomZone.run (dart:async/zone.dart:1093:19)
E/flutter (16700): #10 _runZoned (dart:async/zone.dart:1630:10)
E/flutter (16700): #11 runZonedGuarded (dart:async/zone.dart:1618:12)
E/flutter (16700): #12 _runMainZoned. (dart:ui/hooks.dart:132:5)
E/flutter (16700): #13 _startIsolate. (dart:isolate-patch/isolate_patch.dart:301:19)
E/flutter (16700): #14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter (16700):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant