Unable to build AAR, Task 'assembleAarDebug' not found - flutter

flutter build aar fail
error info :
Task 'assembleAarDebug' not found in root project 'android_generated'.
sudo flutter build aar fixed this problem,but wo want't do it,
fluter doctor info
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable/v1.17.5.taobao, v1.17.0-4.0.pre.32, on Mac OS X 10.15.6 19G2021, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✗] 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:
sudo gem install cocoapods
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.51.1)
[!] Connected device
! No devices available
some one can help me

I fixed this problem
org.gradle.configureondemand=false, This configuration is useful to me, this is the truth。
In the initialization script(aar_init_script.gradle),the task assembleAarDebug is be Added by the method projectsEvaluated。
if you set 'org.gradle.configureondemand=true', The execution order of the script has been modified, The task assembleAarDebug has not been added yet, gradle will execute it。
This is the cause of this error(Unable to build AAR, Task 'assembleAarDebug' not found).
Note that the priority of gradle.properties in the gradle home directory(/Users/username/.gradle/) is higher than that in the project。

Related

Flutter on M1 MBP Unable to run on ios simulator

Here is the output after running doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-arm, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version
32.1.0-rc1)
[!] Xcode - develop for iOS and macOS (Xcode 13.3)
! CocoaPods 1.5.2 out of date (1.10.0 is recommended).
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 upgrade see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.3)
[✓] VS Code (version 1.65.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
I have tried to update CocoaPods, but I still keep getting the above error when I run doctor.
(base) mbp % sudo gem install cocoapods
Successfully installed cocoapods-1.11.3
Parsing documentation for cocoapods-1.11.3
Done installing documentation for cocoapods after 1 seconds
1 gem installed
When running flutter run:
(base) mbp % flutter run
Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Warning: CocoaPods minimum required version 1.9.0 or greater not installed.
Skipping pod install.
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 upgrade see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.

can't build IOS

I encounter this error when i try to build for ios, i tried every solution i could find online
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from
/Users/ahmedaly/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.13/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/ahmedaly/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_ios-6.0.13/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal
error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
Encountered error while building for device.
example of the things i tried:
pod deintegrate
rm podfile.lock
rm pubspec.lock
flutter clean
flutter run
and just about anything similar you could immagine
i also tried removing the file from the path indicated and removing the dependency from pubspec.yaml but it didn’t work
flutter doctor output :
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.0, on macOS 11.6 20G165 darwin-x64, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2021.2.3)
[✓] VS Code (version 1.63.0)
[✓] Connected device (2 available)
• No issues found!
I found a solution in another question on Stack!
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder")
(this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run

Flutter 2.5 cannot recognise sdkmmnager, although everything was fine before upgrading

So yesterday i upgraded flutter to 2.5 and flutter doctor said android-licenses status unknown. So, I ran flutter doctor --android-licenses and it says that sdkmanager not found although the previous version which was probably 2.2.3 didn't say anything like that. I did not install cmdline-tools the "android studio" way. I followed a guide and downloaded the android cmdline-tools.zip file, unpacked it inside "android" folder, made a new tools folder (inside android folder) and copied everything from the android folder to the tools folder. Then I set path to sdkmanager, platform-tools and emulator.
After that I installed platform-tools 31.0.0, android-sdk 31.0.0 and an emulator. At that time flutter was able to recognise sdkmanager and it gave no errors. How do i solve this? Did something related to where the sdkmanager should be located change?
The output of flutter doctor:
[✓] Flutter (Channel stable, 2.5.0, on Arch Linux 5.13.13-zen1-1-zen, locale
en_IN.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for more
details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
and the output of flutter doctor --android-licenses:
cmdline-tools are installed to resolve this.
Also i can run the default app just fine.
I am running linux.
For Windows, you can use this command:
flutter config --android-studio-dir="Path to your Android Studio"
Double check that inside Android Studio > SDK Manager > SDK Tools, Android SDK Command-line Tools are installed.

How to Install Android SDK commandline tool for Flutter upgrade error?

How to install Android SDK commandline tool on a Ubuntu remote server which doesn't have Display/GUI.
When I run, 'flutter upgrade' it gives me the below and I wanted to know if I can use Android SDK commandline tool for resolving the issue.
$flutter upgrade
Upgrading Flutter from /home/yvelumani/flutterDev/sdk/flutter...
Building flutter tool...`
Upgrading engine...
Downloading Android Maven dependencies...
Failed to download the Android dependencies
Downloading Android Maven dependencies... 127.7s (!)
Flutter 1.22.0-10.0.pre.133 • channel master • https://github.com/flutter/flutter.git
Framework • revision 577de1c44e (46 minutes ago) • 2020-09-10 15:55:03 -0700
Engine • revision fee6f9e533
Tools • Dart 2.10.0 (build 2.10.0-110.0.dev)
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.22.0-10.0.pre.133, on Linux, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
✗ Android SDK file not found: adb.
[!] Android Studio (not installed)
[✓] Proxy Configuration
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
I have downloaded android SDK commandline tool from https://developer.android.com/studio#command-tools. But I am not sure how to install this tool and what path to be chosen as ANDROID_HOME?
NOTE: I am not going/able to use Android Studio for my app development.
Thanks for the help in advance.
Android Studio >> Tools >> SDK Manager >> SDK Tools >> Android SDK Command Line Tools

flutter run -bash: Desktop/flutter/bin/flutter: No such file or directory

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.14.6 18G103, locale pl-PL)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, set
ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[!] Android Studio (not installed)
[!] Connected device
! No devices available
I created a my_app folder and typed:
cd my_app
flutter run
The "flutter run" command does not work. How to fix this?
Have you installed android sdk?
If not then installing Android Studio will will install all the required dependencies.
I faced this problem it easy to solve
Open Android Studio
And go to preference
Plugins
Download flutter & dart
You need Android SDK, if you plan on using Android Studio then SDK will be downloaded with the Android Studio
https://developer.android.com/studio is the link to download