Finished with error: Gradle task assembleDebug failed with exit code -1, Flutter - android-studio

I recently updated the Android Studio, After that project is not running.
flutter run -v
Gradle task assembleDebug failed with exit code -1
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 buildGradleApp (package:flutter_tools/src/android/gradle.dart:387:7)
#2 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#3 _rootRunUnary (dart:async/zone.dart:1134:38)
#4 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#5 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#7 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#8 Future._completeWithValue (dart:async/future_impl.dart:524:5)
#9 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:32:15)
#10 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:290:13)
#11 _DefaultProcessUtils.stream (package:flutter_tools/src/base/process.dart)
#12 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#13 _rootRunUnary (dart:async/zone.dart:1134:38)
#14 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#15 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#16 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#17 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#18 Future._addListener.<anonymous closure> (dart:async/future_impl.dart:389:9)
#19 _rootRun (dart:async/zone.dart:1126:13)
#20 _CustomZone.run (dart:async/zone.dart:1023:19)
#21 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#22 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#23 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#24 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#25 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#26 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)
Then I run flutter doctor -v
doctor --verbose
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-IN)
• Flutter version 1.12.13+hotfix.8 at C:\Users\shiva\flutter_src\flutter
• Framework revision 0b8abb4724 (8 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\shiva\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:/Users/shiva/AppData/Local/Android/Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] IntelliJ IDEA Community Edition (version 2018.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.5
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[√] VS Code (version 1.44.0)
• VS Code at C:\Users\shiva\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.9.1
[√] Connected device (1 available)
• ASUS X00TD • J9AAGF11K219NMK • android-arm64 • Android 9 (API 28)
! Doctor found issues in 2 categories.
Process finished with exit code 0
Problem is with licensing and all, then I run
flutter doctor --android-licenses
!Error
A newer version of the Android SDK is required. To update, run:
usersDirPath\AppData\Local\Android\Sdk\tools\bin\sdkmanager --update
Then I run
sdkmanager --update
It shows up
Warning: Unknown argument -v
Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:419)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
What I have tried
Changing jdk version to 8
https://github.com/flutter/flutter/issues/31116#issuecomment-529807607
Installing Android SDK 26.1.1 (obsolete)
https://github.com/flutter/flutter/issues/51670#issuecomment-593068819
Even uninstalling the android studio completely and installing it again.
Help me solve this error.
Android Studio version 3.6.2
Edit
I somehow(re-install) manage to accept all the licenses, but the error is still same.
Gradle task assembleDebug failed with exit code -1
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 buildGradleApp (package:flutter_tools/src/android/gradle.dart:387:7)
#2 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#3 _rootRunUnary (dart:async/zone.dart:1134:38)
#4 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#5 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#7 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#8 Future._completeWithValue (dart:async/future_impl.dart:524:5)
After running flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.18363.720], locale en-IN)
• Flutter version 1.12.13+hotfix.9 at C:\Users\shiva\flutter
• Framework revision f139b11009 (12 days ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\shiva\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• 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_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] IntelliJ IDEA Community Edition (version 2018.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.5
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[√] VS Code (version 1.44.0)
• VS Code at C:\Users\shiva\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.9.1
[√] Connected device (1 available)
• ASUS X00TD • J9AAGF11K219NMK • android-arm64 • Android 9 (API 28)
! Doctor found issues in 1 category.

Related

NDK version conflict in buildozer for Kivy app

I am trying to build a kivy app that has these requirements in buildozer.spec:
requirements = python3,kivy,pillow,plyer,scipy,numpy
all Android (SDK/NDK, API) settings are defaulted (commented)
One run w/o specifying NDK gives:
[INFO]: <- directory context /home/joachim/PycharmProjects/CardReader/.buildozer/android/platform/python-for-android
[WARNING]: install_libs called with no libraries to install!
[INFO]: Building lapack for arm64-v8a
[INFO]: -> directory context /home/joachim/PycharmProjects/CardReader/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/lapack/arm64-v8a__ndk_target_21/lapack/build
[ERROR]: Build failed: Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (supported NDK version: 'r21e')
When I clean and then set NDK to 21e and run again I get the other error:
[INFO]: Will compile for the following archs: arm64-v8a, armeabi-v7a
[INFO]: Found Android API target in $ANDROIDAPI: 27
[INFO]: Available Android APIs are (27)
[INFO]: Requested API target 27 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK: /home/joachim/.buildozer/android/platform/android-ndk-r21e
[INFO]: Found NDK version 21e
[ERROR]: Build failed: The minimum supported NDK version is 23. You can download it from https://developer.android.com/ndk/downloads/.
[INFO]: Instructions: Please, go to the android NDK page (https://developer.android.com/ndk/downloads/) and download a supported version.
*** The currently recommended NDK version is 23b ***
How can this mismatch be solved? Looking for supported NDK with gcc/gfortran support.
Or, what needs to be set for LEGACY_NDK ?
So I've just ran into that problem and found a solution.
The issue was that to build scipy python for android needs an android ndk that was built with fortran support. These appear to be only supported with NDK version 21 and lower and the NDK needs to be specifically built with fortran support. Luckily someone hosts prebuilt versions for that purpose. https://github.com/mzakharo/android-gfortran/releases (Linux only, if you are building the APK from windows you need to build your own NDK toolchain as described in the readme of that project)
Then you have to do the following:
First you need to download the legacy NDK via buildozer
For this modifiy in buildozer.spec:
#android.ndk = 23b --> android.ndk = 21e
Then Execute
buildozer android debug
When it fails (this is ok since we only ran buildozer to download the r21 NDK):
tar -jxvf gcc-arm-linux-x86_64.tar.bz2
mv arm-linux-androideabi-4.9 ~/.buildozer/android/platform/android-ndk-r21e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
Note: change ~/.buildozer to the path where buildozer stores your ndks
Then revert the changes to buildozer.spec:
android.ndk = 21e --> #android.ndk = 23b
Now you can build and deploy with
export LEGACY_NDK=~/.buildozer/android/platform/android-ndk-r21e
buildozer android debug deploy run
Note: change ~/.buildozer as described above

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' in flutter

Flutter was working perfectly on previous device. I have changed my laptop, after all the setup I am getting this error I am unable to understand this error.
please explain what is this error for.
Solution for this error
I am just running very basic application.
app gradle
> def localProperties = new Properties() def localPropertiesFile =
> rootProject.file('local.properties') if (localPropertiesFile.exists())
> {
> localPropertiesFile.withReader('UTF-8') { reader ->
> localProperties.load(reader)
> } }
>
> def flutterRoot = localProperties.getProperty('flutter.sdk') if
> (flutterRoot == null) {
> throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }
>
> def flutterVersionCode =
> localProperties.getProperty('flutter.versionCode') if
> (flutterVersionCode == null) {
> flutterVersionCode = '1' }
>
> def flutterVersionName =
> localProperties.getProperty('flutter.versionName') if
> (flutterVersionName == null) {
> flutterVersionName = '1.0' }
>
> apply plugin: 'com.android.application' apply plugin: 'kotlin-android'
> apply from:
> "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
>
> android {
> compileSdkVersion 29
>
> sourceSets {
> main.java.srcDirs += 'src/main/kotlin'
> }
>
> lintOptions {
> disable 'InvalidPackage'
> }
>
> defaultConfig {
> // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
> applicationId "com.example.flutter_app"
> minSdkVersion 16
> targetSdkVersion 29
> versionCode flutterVersionCode.toInteger()
> versionName flutterVersionName
> }
>
> buildTypes {
> release {
> // TODO: Add your own signing config for the release build.
> // Signing with the debug keys for now, so `flutter run --release` works.
> signingConfig signingConfigs.debug
> }
> } }
>
> flutter {
> source '../..' }
>
> dependencies {
> implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }
android gradle
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Logcat:
Please configure Android SDK
Terminal report
C:\Users\HP\StudioProjects\flutter_app>flutter run
Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 29 in C:\Users\HP\AppData\Local\Android\sdk\licenses
Warning: License for package Android SDK Platform 29 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\HP\AppData\Local\Android\sdk
* 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
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 2.5s
Exception: Gradle task assembleDebug failed with exit code 1
Flutter doctor - V
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18362.1082], locale en-US)
• Flutter version 1.22.0 at C:\src\flutter
• Framework revision d408d302e2 (4 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\HP\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• 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)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 50.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.49.2)
• VS Code at C:\Users\HP\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
! Doctor found issues in 1 category.
Run this command to accept all license from Android.
flutter doctor --android-licenses and download sdk manager and build tools from Android studio
Apparently, what you can do is simply head to your Android SDK directory
and
cd "/tools/bin"
and run the following command
sdkmanager --licenses
and let the terminal do its job !
Here is the main problem
Failed to install the following Android SDK packages as some licenses have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-29 Android SDK Platform 29
As the error suggests, first accept all licenses by running the following command
flutter doctor --android-licenses
next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3
After downloading extract the zip file into C:\Android\Sdk\build-tools\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac
finally, download the missing Android SDK platform 29 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-29 if you are on mac or C:\Android\Sdk\platforms\android-29 if you are on windows
Run your project (flutter run) and enjoy

This requires non-nullable language feature to be enabled — Dart non-nullable syntax error

I've activated Dart non-nullable syntax experiment in my pubspec.yaml file:
name: tests
description: A new Flutter application.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.9.0-21.0.dev.flutter <3.0.0"
analyzer:
enable-experiment:
- non-nullable
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
So, now after running flutter pub get I'm trying to create a class using non-nullable syntax:
class Component_Decorator_A extends Component_Decorator {
Component_Decorator_A([Component? component]) : super(component);
#override
operation() {
component?.operation();
print('Component_Decorator_A.Operation()');
}
}
Quite surprisingly, syntax analyzer in Android Studio says:
This requires non-nullable language feature to be enabled. Try updating your pubspec.yaml to set the minimum SDK constraint to 2.9.9 or higher, and running pub get.
Ok, I cannot set the minimum SDK version to exactly 2.9.0 as suggested, as far as each time I try to set environment: sdk: ">=2.9.0 <3.0.0" in my pubspec.yaml, the subsequent flutter pub get leads to the next version solving error that I was unable to resolve:
flutter pub get
Running "flutter pub get" in master000...
The current Dart SDK version is 2.9.0-21.0.dev.flutter-2e05e6c94a.
Because patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0, version solving failed.
---- Log transcript ----
FINE: Pub 2.9.0-21.0.dev.flutter-2e05e6c94a
MSG : Resolving dependencies...
SLVR: fact: patterns_experiments_and_tests is 1.0.0+1
SLVR: derived: patterns_experiments_and_tests
SLVR: fact: patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0
SLVR: conflict: patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0
SLVR: Version solving took 0:00:00.060030 seconds.
| Tried 1 solutions.
FINE: Resolving dependencies finished (0.1s).
ERR : The current Dart SDK version is 2.9.0-21.0.dev.flutter-2e05e6c94a.
|
| Because patterns_experiments_and_tests requires SDK version >=2.9.0 <3.0.0, version solving failed.
FINE: Exception type: SolveFailure
FINE: package:pub/src/solver/version_solver.dart 312:5 VersionSolver._resolveConflict
| package:pub/src/solver/version_solver.dart 133:27 VersionSolver._propagate
| package:pub/src/solver/version_solver.dart 97:11 VersionSolver.solve.<fn>
| ===== asynchronous gap ===========================
| dart:async Future.catchError
| package:pub/src/utils.dart 113:52 captureErrors.wrappedCallback
| package:stack_trace Chain.capture
| package:pub/src/utils.dart 126:11 captureErrors
| package:pub/src/command_runner.dart 193:13 PubCommandRunner.runCommand
---- End log transcript ----
pub get failed (1; ---- End log transcript ----)
Process finished with exit code 1
It should be noted here that flutter doctor -v reports that everything is pretty 'OK' in the project:
[✓] Flutter (Channel master, 1.21.0-5.0.pre, on Mac OS X 10.15.5 19F101, locale ru-RU)
• Flutter version 1.21.0-5.0.pre at /Applications/flutter
• Framework revision 2a063fc6c0 (11 дней назад), 2020-07-17 12:51:01 -0400
• Engine revision 1493883bf0
• Dart version 2.9.0 (build 2.9.0-21.0.dev 2e05e6c94a)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at /Users/sergeglushenko/Library/Android/sdk
• Platform android-30, build-tools 30.0.0
• 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 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.8.4
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Connected device (1 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.5 19F101
Would you please suggest me what should be done to make Dart non-nullable syntax steadily usable in Android Studio (latest version)?
I think this issue was being resolved with the new version. The migration guide for null safety is out now a mentioned in this comment:
Please read https://dart.dev/null-safety/migration-guide. You can't
just turn on null safety. We have docs and migration tooling available
for you!
And if it still doesn't work, try the suggestion here:
You should increase your current sdk version from sdk: ">=2.7.0
<3.0.0" to sdk: ">=2.12.0 <3.0.0" and run flutter pub get. If you
don't want to do that manually, you should run dart migrate --apply-changes in terminal. I recommend the second one

I am having problems in android studio configuration can any help me?

I started Android Studio and installed it nd check in cmd also by Flutter doctor it shows everything right. But when I run hello world program it shows many errors can anyone help me plz. below i pasted the codes
error:
The method 'MaterialApp' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:9)
error: The method 'ThemeData' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:12)
error: Undefined name 'Colors'. (undefined_identifier at [helloword] lib\MyApp.dart:13)
error: Undefined name 'Colors'. (undefined_identifier at [helloword] lib\MyApp.dart:14)
error: The method 'Scaffold' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:16)
error: The method 'AppBar' isn't defined for the type 'MyApp'. (undefined_method at [helloword] lib\MyApp.dart:17)
error: Undefined name 'Colors'. (undefined_identifier at [helloword] lib\MyApp.dart:19)
error: Named parameters must be enclosed in curly braces ('{' and '}'). (named_parameter_outside_group at [helloword] lib\main.dart:4)
error: A function body must be provided. (missing_function_body at [helloword] lib\main.dart:4)
error: Default values aren't allowed in function typed parameters. (default_value_in_function_typed_parameter at [helloword] lib\main.dart:4)
error: A function body must be provided. (missing_function_body at [helloword] lib\main.dart:4)
error: The function 'MyApp' isn't defined. (undefined_function at [helloword] test\widget_test.dart:16)
info: Name non-constant identifiers using lowerCamelCase. (non_constant_identifier_names at [helloword] lib\main.dart:4)
info: Unused import: 'package:helloword/main.dart'. (unused_import at [helloword] test\widget_test.dart:11)
Make sure you have installed Android studio flutter plugin and Flutter sdk is set up in your path.
Follow the guide from flutter.dev
May be you are missing the material import.
make sure you have
import: package: flutter/material.dart
..also try running flutter packages get once again.
Hope it helps..
C:\Users\user>flutter doctor --verbose
[√] Flutter (Channel stable, v1.17.3, on Microsoft Windows [Version 10.0.18362.836], locale en-IN)
• Flutter version 1.17.3 at c:\src\flutter\flutter
• Framework revision b041144f83 (6 days ago), 2020-06-04 09:26:11 -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\user\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)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] Connected device
! No devices available

.NET Standard 2.0 Xamarin.iOS project VSTS build issue

Currently I'm trying to upgrade a Xamarin.Forms project to use .NET Standard 2.0. This went fine for Android but I'm getting stuck with the iOS version. To build iOS we use a On-Primise MacMini as build agent int VSTS. Now I'm getting the error below when building the solution.
=================================
.... way more erros like below ...
2017-11-21T11:39:43.8920830Z ViewModels/DashboardViewModel.cs(66,35): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9014700Z ViewModels/DashboardViewModel.cs(66,73): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9036150Z ViewModels/DashboardViewModel.cs(66,93): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [/Users/Admin/BuildAgent/_work/3/s/xxx.App/xxx.Core.csproj]
2017-11-21T11:39:43.9053280Z
2017-11-21T11:39:43.9083060Z 6 Warning(s)
2017-11-21T11:39:43.9107960Z 47 Error(s)
2017-11-21T11:39:43.9116100Z
2017-11-21T11:39:43.9131830Z Time Elapsed 00:00:59.23
2017-11-21T11:39:43.9327960Z ##[error]Xamarin.iOS task failed with error Error: /Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild failed with return code: 1. For guidance on setting up the build definition, see https://go.microsoft.com/fwlink/?LinkId=760847.
2017-11-21T11:39:43.9575950Z [command]/usr/bin/security delete-keychain /Users/Admin/BuildAgent/_work/3/s/_xamariniostasktmp.keychain
2017-11-21T11:39:44.2658340Z ##[section]Finishing: Build Xamarin.iOS solution xxx.sln
=================================
This output comes from the following build definition:
Now I've searched the internet and found a view possible solutions:
Update Visual Studio on the MacMini
Update XCode on the MacMini
Install .NET Core 2.x SDK on the MacMini
Add .NET Standard 2.x NuGet package to Xamarin.IOS project
Add .NET Standard Library NuGet pre-release package to Xamarin.iOS project (not possible)
Manually reference netstandard.dll to the Xamarin.iOS project
Remove install argument (not using it)
But all of this was not enough to fix the issue. Now I'm not a expert in using a Mac. Actually I never touched one before this issue... So I might have done something wrong here...
But I've been able to get some version information about all products on the MacMini:
========= Visual Studio =========
Visual Studio Community 2017 for Mac
Version 7.2.2 (build 11)
Installation UUID: b43353ef-651c-468b-8b7d-3f1714586419
Runtime:
Mono 5.4.1.6 (2017-06/1f4613aa1ac) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 504010006
NuGet
Version: 4.3.1.4445
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.3
SDK: /usr/local/share/dotnet/sdk/2.0.3/Sdks
SDK Version: 2.0.3
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/msbuild/15.0/bin/Sdks
Xamarin.Profiler
Version: 1.5.6
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Xamarin.Android
Not Installed
Xamarin Inspector
Not Installed
Apple Developer Tools
Xcode 9.1 (13532)
Build 9B55
Xamarin.iOS
Version: 11.3.0.47 (Visual Studio Community)
Hash: 51128b8c
Branch: xcode9.1
Build date: 2017-10-31 22:42:13-0400
Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
Build Information
Release ID: 702020011
Git revision: b604c37c5a4a2f0919b45ffbe2aaad9fe040af31
Build date: 2017-11-01 08:31:43-04
Xamarin addins: d57dc14cbd4eb166ee62bab585965ab78d3650bc
Build lane: monodevelop-lion-d15-4
Operating System
Mac OS X 10.12.6
Darwin 16.7.0 Darwin Kernel Version 16.7.0
Wed Oct 4 00:17:00 PDT 2017
root:xnu-3789.71.6~1/RELEASE_X86_64 x86_64
============= XCode =============
XCode for Mac
Version 9.1 (9B55)
============= Mono ==============
Mono JIT compiler version 5.4.1.6 (2017-06/1f4613aa1ac Wed Oct 18 09:31:57 EDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: yes(3.6.0svn-mono-master/8b1520c8aae)
GC: sgen (concurrent by default)
========= .NET Core SDK =========
.NET Core SDK
Version 2.0.3
=================================
The project can be build on the MacMini itself. Only the VSTS task keeps failing...
Does someone have any idea's left which can help me solve my issue?
Kind regards,
Jop
Everything started to work fine after we manually edited the .NET Standard 2.0 project file (*.csproj) and add a PackageReference by hand.
<ItemGroup>
...
<PackageReference Include="NETStandard.Library" version="2.0.0" />
...
</ItemGroup>

Resources