I'm trying to get a basic hello world project running using flutter. These are the steps that I have taken to install Flutter on a windows machine, running Window 10 Pro.
Downloaded flutter_windows_v0.9.4-beta.zip and extracted to c:\src\
Add location to environment settings ... C:\src\flutter
Downloaded and installed Android Studio and Setup an emulator using ADV Manager.
Downloaded and installed Visual Studio Code
Added Dart 2.19.0 Extension
Added Flutter 2.19.0 Extension
Run Flutter doctor
[flutter] flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.9.4, on Microsoft Windows [Version 10.0.15063], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.28.2)
[√] Connected devices (1 available)
Create a new flutter project
Deleted code under Test folder
Replaced code in main.dart with ...
import 'package:flutter/material.dart';
void main() {
runApp(Center(
child: Text(
"this is a test",
textDirection: TextDirection.ltr,
),
));
}
Ran project and get the following error ...
Launching lib\main.dart on Android SDK built for x86 in debug mode...
* Error running Gradle:
Exit code 1 from: C:\Users\to0589\Desktop\flutter projects\asad\android\gradlew.bat app:properties:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\to0589\Desktop\flutter projects\asad\android\app\build.gradle' line: 25
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
* 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 1s
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
Can anyone tell me where I went wrong please Any assistance greatly appreciated.
That's not a problem in your install. This is a problem that many people are facing with current flutter version.
It's already fixed. However, it's not yet released to the most stable version.
If you change the flutter channel to master, you'll see that it will run normally.
You can use the master channel for now and then switch it back to dev.
flutter channel master
flutter upgrade
# to see all the channels, run
flutter channel
https://github.com/flutter/flutter/pull/23397
In short, following Mahi-K from the above link, you have to edit $flutterRoot/packages/flutter_tools/gradle/flutter.gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
In the gradle wrapper properties gradle/wrapper/gradle-wrapper.properties you may also have to change it to 4.6 or above
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Open the root flutter folder in your computer, and open the gradle folder in that root folder (For example C:\flutter\package\flutter_tool\gradle) and add 'google()' to the buildscript. It fixed the issue for me.
flutter root folder:
Add 'google()' in the buildscript:
update flutter or use one of the previous version of gradle by changing the class path in this section.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}}
Related
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.
i am learning flutter and this is the error i get in both vs code as well as android studio.
i tried looking for answer and also tried some fixes but never worked
flutter run
Launching lib/main.dart on Redmi Note 7 in debug mode...
Initializing gradle... 1.6s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "E:\flutterprojects\testerapp\android\gradlew.bat" exited abnormally:
Configure project :app
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\pragya\AppData\Local\Android\sdk\licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.3)".
FAILURE: Build failed with an exception.
Where:
Build file 'E:\flutterprojects\testerapp\android\build.gradle' line: 24
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
Failed to notify project evaluation listener.
org/apache/commons/compress/archivers/zip/ZipFile
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 3s
Command: E:\flutterprojects\testerapp\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
i expect the code to run. this is the default code provided by dart so there should have been no mistakes in the code.
i try to use map view in my flutter project and when i run the app i got some errors :
Error running Gradle:
ProcessException: Process "E:\flutterProjects\flutter_course\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 fullinsights.
Get more help at https://help.gradle.org
BUILD FAILED in 15s
Command: E:\flutterProjects\flutter_course\android\gradlew.bat >app:properties
Please review your Gradle project setup in the android/ folder.
on my mac machine i have installed android studio and set up the android home, i am able to run the app in ios emulator, however when i am trying to run the same app in android emulator using the command:
ionic cordova build android
I am getting the following error:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.3-2)
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'.
> d29vzk4ow07wi7.cloudfront.net
lot of Kotlin updates related error, in the Android studio in the configure menu i did update the Kotlin plugins and restarted the machine as well.
Any help on the same would be highly appreciated.
In the Android SDK manager i had to uncheck Kotlin in the plugins :(
I've got an Ionic 3.4 project and trying to build it to Android for testing purposes.
I installed Android Studio and the Android SDK, aswell Java 8. Then did:
ionic cordova platform add android
Then, when I write...
ionic build android
... I get the following error:
cordova build android ✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit
code 1):
ANDROID_HOME=C:\Users\Zerok\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
What's going on? I also installed Gradle 4.0 into the Java folder, and pointed towards it in the GRADLE_HOME environment variable:
Var name: GRADLE_HOME
Value: C:\Program Files\Java\gradle-4.0
Also added the following to the path:
GRADLE_HOME\bin
But it still throws the same error... I don't think it's a problem with plugins, but with the Ionic/Cordova build system. What I don't understand, is why it needs Gradle when it's perfectly working in Android Studio, maybe it's because it's not in C:/, but a different disk? Any ideas?
(Assuming Windows 10)
open Start Menu, type path and hit Enter
System Properties will open. On the bottom click Environment Variables...
In the window that opens, on the bottom section named System Variables, double click Path
Click New and copy paste the path to your gradle installation
Make sure the path environment variable points to the bin folder of gradle like so: export PATH="$PATH:/home/jeffbl/android-studio/gradle/gradle-3.2/bin".
If that doesn't work try:
$ cordova platform rm android && cordova platform add https://github.com/apache/cordova-android && cordova build
If that doesn't work then use the SDK manager to downgrade to an earlier version of your SDK. It might be that there is no graddle wrapper out yet for the latest.
In any case you will find the answer to your problem in this github issue.
Ok, I already fixed it. And the fix is weird as hell, but well, at least it works.
Solution: uninstall Android Studio and install it in the main drive (C in my case). Everything began to work perfectly after this clean install.