Build error with map_view, flutter & gradle? - gradle

I get a build error using flutter version 1.2.2 and map_view version 0.0.14.
I tried to use this code in build.gradle
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'
I followed all the steps here https://pub.dartlang.org/packages/map_view#-readme-tab-
I have an api-key but get the following build error
Finished with error: Please review your Gradle project setup in the
android/ folder.
* Error running Gradle: ProcessException: Process "C:\Users\Almoit PC\Desktop\MyApp\Map\flutter_app2\android\gradlew.bat" exited
abnormally:
Configure project :map_view
WARNING: The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
FAILURE: Build failed with an exception.
What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'android' is using
version 1.1.2-4.
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 10s Command: C:\Users\Almoit
PC\Desktop\MyApp\Map\flutter_app2\android\gradlew.bat app:properties
flutter doctor -v
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17763.437], locale en-AI)
• Flutter version 1.2.1 at C:\flutter
• Framework revision 8661d8aecd (10 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 33.4.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[√] Connected device (1 available)
• SPH L520 • 2d81b4cf • android-arm • Android 4.4.2 (API 19)
• No issues found!

Related

Flutter not able to run, get_navigation & theme error

i'm actually trying to run my app but i'm stucked with that error :
Running "flutter pub get" in riverpod_stacked_app...
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:235:37: Error: No named parameter with the name 'shadowThemeOnly'.
final theme = Theme.of(context, shadowThemeOnly: true);
^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:431:43: Error: No named parameter with the name 'shadowThemeOnly'.
theme: Theme.of(key.currentContext, shadowThemeOnly: true),
^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
FAILURE: Build failed with an exception.
* Where:
Script '/Users/Alex/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 900
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/Alex/development/flutter/bin/flutter'' finished with non-zero exit value 1
* 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 19s
Exception: Gradle task assembleDebug failed with exit code 1
I don't understand why it can't build. I don't see the link between those 2 errors :
get_navigation
something with the theme from material.dart
And my actual motivation to use riverpod, stacked_services and firebase.
Here is the result of flutter doctor -v :
[✓] Flutter (Channel master, 1.24.0-8.0.pre.98, on Mac OS X 10.15.7 19H2 darwin-x64, locale fr-FR)
• Flutter version 1.24.0-8.0.pre.98 at /Users/Alex/development/flutter
• Framework revision ef4ec09a06 (6 hours ago), 2020-11-05 08:02:13 -0800
• Engine revision bf259226b2
• Dart version 2.12.0 (build 2.12.0-21.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/Alex/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/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 installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] 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-6222593)
[✓] Connected device (1 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
! Doctor found issues in 1 category.
And here is my dependencies in pubspeck.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
stacked_services:
auto_route: 0.6.9
hooks_riverpod: 0.12.1
flutter_hooks:
firebase_core: 0.5.1
firebase_auth: 0.18.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner:
auto_route_generator:
Any ideas ? I've trie to clean up my dependencies and reinstall. Also i start a blank project with flutter counter app and it runs properly.
I also had this problem today after upgrading Flutter.
I was only able to solve it after I deleted that method parameter from the file that triggered the error. You'll have to delete it in two places.
Search in .pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart for
Theme.of(key.currentContext, shadowThemeOnly: true)
As replace it with
Theme.of(key.currentContext)
This is probably cause by the stacked_services dependency that uses the get: ^3.15.0 dependency
Later edit: this is actually not the best solution, because somebody cloning your repo will not be able to compile the project unless they also to this change
So it's better to upgrade the dependency that causes this error, or replace it with another one; but only after you ran flutter upgrade, or try changing the channel
this is already fixed by getx in 16.1. Pub upgrade will do it
https://github.com/jonataslaw/getx/issues/762
you need to remove only
ThemeData theme = Theme.of(key.currentContext, shadowThemeOnly: false);
if (theme != null) {
bottomSheet = new Theme(data: theme, child: bottomSheet);
}
return bottomSheet;
form your .pubcach folder.

flutter image_picker package compile error [ it works under 0.6.0 but not over ]

when I run flutter i got these messages.
Launching lib\main.dart on SM G930S in debug mode...
Running Gradle task 'assembleDebug'...
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :location_web not found. Please update settings.gradle.
Plugin project :firebase_auth_web not found. Please update settings.gradle.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> File 'com.android.builder.files.ZipCentralDirectory#116a0403' was deleted, but previous version not found in cache
* 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 26s
Exception: Gradle task assembleDebug failed with exit code 1
my pubspect.yaml
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# a b c d e f g h i j k l m n o p q r s t u v w x y z
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
animated_floatactionbuttons: ^0.1.0
awesome_dialog: ^1.1.3
awsome_video_player: ^1.0.8+1
badges: ^1.1.1
cupertino_icons: ^0.1.3
carousel_slider: ^2.2.1
cached_network_image: ^2.2.0+1
cached_video_player: ^1.0.3
email_validator: ^1.0.5
firebase_auth: ^0.16.1
flutter_bloc: ^6.0.1
flutter_money_formatter: ^0.8.2
flutter_gifimage: ^1.0.0
flutter_speed_dial: ^1.2.5
flutter_styled_toast: ^1.3.0
flutter_swiper: ^1.1.6
flutter_svg: ^0.17.0
fluttertoast: ^7.0.2
flick_video_player: ^0.1.1
get: ^3.4.6
getwidget: ^1.1.3
geolocator: ^5.3.2+2
google_nav_bar: ^2.2.0
google_maps_flutter: ^0.5.30
http: ^0.12.2
image_stack: ^1.1.0
image_picker: ^0.5.4+3
path_provider: ^1.6.11
path: ^1.6.4
line_icons: ^0.2.0
location: ^3.0.0
logger: ^0.9.2
provider: ^4.3.2+1
url_launcher: ^5.5.0
shared_preferences: ^0.5.8
smooth_star_rating: ^1.1.1
regexpattern: ^0.2.3
video_player: ^0.10.12
video_player_controls: ^2.1.6
dev_dependencies:
flutter_test:
sdk: flutter
Flutter Doctor report
[√] Flutter (Channel unknown, v1.17.5, on Microsoft Windows [Version 10.0.18363.1016], locale ko-KR)
• Flutter version 1.17.5 at C:\src\flutter
• Framework revision 8af6b2f038 (8 weeks ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Silenmus\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.3
• 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 48.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.47.3)
• VS Code at C:\Users\Silenmus\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.13.2
[√] Connected device (2 available)
• SM G930S • ce0416040ac8423d04 • android-arm64 • Android 8.0.0 (API 26)
• sdk gphone x86 • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
I tried these to solve this problem
made new project and all copy of my project packages and run it
=> it works == I think it's not packages dependency problem
run AVD same error occurs
Changed image_picker version
=> ^0.5.4+3 works
=> over ^0.6.0 doesn't
I have no idea what's wrong with me or code or package or flutter 😫
# animated_floatactionbuttons: ^0.1.0
# awsome_video_player: ^1.0.8+1
# cached_video_player: ^1.0.3
# flutter_bloc: ^6.0.1
# regexpattern: ^0.2.3
# flick_video_player: ^0.1.1
i remove unused packages and it works
if someone who like me ,
remove package one by one it could save your debugging time. 😉

Display an error while debug the flutter App in vscode

I can't debug my Flutter App in Vscode , and DEBUG CONSOL returned :
Unable to locate a development device; please run 'flutter doctor' for
information about installing additional components.
I can show my emulator after run this :
flutter emulators
And i can run it :
flutter emulators --launch 4.7_WXGA_API_22
flutter doctor -v :
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Linux, locale en_US.UTF-8)
• Flutter version 1.7.8+hotfix.4 at /home/ZZZ/Dev/Flutter/flutter
• Framework revision 20e59316b8 (10 days ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /media/ZZZ/B0B8B687B8B64C1A/Dev_ubuntu/android-sdk-linux/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /media/ZZZ/B0B8B687B8B64C1A/Dev_ubuntu/android-sdk-linux/
• Java binary at: /usr/local/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)
• All Android licenses accepted.
[✓] Android Studio (version 3.4)
• Android Studio at /usr/local/android-studio
• Flutter plugin version 37.1.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b16-5323222)
[✓] VS Code (version 1.36.1)
• VS Code at /usr/share/code
• Flutter extension version 3.2.0
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)
• No issues found!
My operating system is Ubuntu 18.04 and i want to use emulator for debug , please help me.
You are having 3 options:
You can open your emulator in Android Studio and after that debug your application from VSCode.
You can also check whether adb(Android debugger bridge) is installed in your machine or not.
Or else you can run your application in a real device.
My problem was solved by this command
flutter config --android-sdk <sdk-location>
link

Cannot do "flutter packages upgrade". I get socket error

I am trying to start a new flutter project, I followed the getting started guide, installed android studio, flutter sdk, got a device working, added flutter package to VScode. you can see my flutter doctor output here:
D:\Workspace\flutter_app>flutter doctor -v
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version 6.1.7601],
locale en-US)
• Flutter version 0.8.2 at C:\src\flutter
• Framework revision 5ab9e70727 (4 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at C:\Users\baib37302\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_152-release-1136-
b06)
• All Android licenses accepted.
[√] Android Studio (version 3.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 29.0.2
• Dart plugin version 181.5616
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-
b06)
[√] VS Code (version 1.27.2)
• VS Code at C:\Users\baib37302\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 2.19.0
[√] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0
(API 27) (emulator)
• No issues found!
I am working behind a corporate proxy, but I added this to environment variables: HTTP_PROXY : http://"user":"pass"#proxy:8080
As you can see, Everything looks great. The only issue is I cannot run the project, because running "Flutter run" starts executing "flutter packages get" which is not working due to a socket error when connecting to https://pub.dartlang.org. As you can see here:
D:\Workspace\flutter_app>flutter packages get
Running "flutter packages get" in flutter_app...
Got socket error trying to find package node_preamble at
https://pub.dartlang.org.
pub get failed (69) -- attempting retry 1 in 1 second...
This issue comes up when trying to run from android studio or vs code.
I even tried getting pubscpec.lock file from an example project to try to work around this issue, but that failed as running "flutter install" ends up with gradle error as you can see in:
Flutter crash report; please file at https://github.com/flutter/flutter/issues.
## command
flutter install
## exception
String: Exit code 1 from: D:\Workspace\flutter_app\android\gradlew.bat -v:
Downloading https://services.gradle.org/distributions/gradle-4.4-all.zip
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:61)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

Error running flutter app in both Android studio and Xcode

I am facing this issue after I have switched from beta channel to master and whenever I try to run my Flutter application in either android studio or Xcode I get this error:
2018-09-20 15:18:16.711602+0100 Runner[7370:3358571] ../../third_party/dart/runtime/vm/kernel_binary.cc: 39: error: Invalid kernel binary format version (found 5, expected 7)
2018-09-20 15:18:16.711665+0100 Runner[7370:3358571] Dumping native stack trace for thread 9e03
2018-09-20 15:18:16.735476+0100 Runner[7370:3358571] [0x00000001056f5d64] dart::Profiler::DumpStackTrace(void*)
2018-09-20 15:18:16.735963+0100 Runner[7370:3358571] [0x00000001056f5d64] dart::Profiler::DumpStackTrace(void*)
2018-09-20 15:18:16.736001+0100 Runner[7370:3358571] [0x0000000000000000] Unknown symbol
2018-09-20 15:18:16.737556+0100 Runner[7370:3358571] [0x00000001055f7378] dart::kernel::Program::ReadFromBuffer(unsigned char const*, long, bool)
2018-09-20 15:18:16.737589+0100 Runner[7370:3358571] -- End of DumpStackTrace
This is my flutter doctor:
[✓] Flutter (Channel master, v0.9.3-pre.3, on Mac OS X 10.13.4 17E199, locale en-GB)
• Flutter version 0.9.3-pre.3 at /Users/heyab/flutter
• Framework revision 8b5af14f24 (17 hours ago), 2018-09-19 15:42:51 -0700
• Engine revision 2e8e96fad1
• Dart version 2.1.0-dev.4.0.flutter-4eb879133a
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at ....
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
• ios-deploy 1.9.2
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 24.2.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] Connected devices (2 available)
• No issues found!
Can anyone help me please?
I have managed to fix this issue: by going to Build Phases -> Run Script and add:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
and then untick "run script only when installing" -> Code Cleanup -> Build Project -> And perfectly working now! :)

Resources