Where are Gradle detailed logs when building Flutter application in debug mode? - gradle

I am debugging my Flutter application and sometimes I get Gradle build errors. That's fine, some configuration is incorrect.
However it is difficult to find the actual problem as the debug console is not displaying any details, such as which row is breaking the build.
There's no error trace.
Launching lib\main.dart on Android SDK built for x86 in debug mode...
* Error running Gradle:
ProcessException: Process "C:\Users\<USER>\Projects\<app>\android\gradlew.bat" exited abnormally:
Command: C:\Users\<USER>\Projects\<APP>\android\gradlew.bat app:properties
Please review your Gradle project setup in the android/ folder.
Exited (sigterm)
Where, or how, can I see the Gradle logs when building a Flutter application in debug mode?
Here is a print too.

You should edit your $HOME/.gradle/gradle.properties file by adding:
org.gradle.console=verbose
and run
flutter run -v
Here a piece of output in VSCode

You can open the Android part of your project with AndroidStudio to help you understand the gradle errors.
With IntelliJ or VSCode, you just have to right click on android folder and click "Open in Android Studio"

Related

xcode_backend.sh: no such file or directory. Do I need to create this file?

My Flutter Project won't run on the ios simulator and is throwing this error:
Launching lib/main.dart on iPhone Xʀ in debug mode...
Running Xcode build...
Xcode build done. 7.6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Could not build the application for the simulator.
Error launching application on iPhone Xʀ.
The xcode error was also as follows:
/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
I've already tried running flutter doctor and there were no errors.
I also tried re-rooting my xcode 'FLUTTER_ROOT' and 'FLUTTER_APPLICATION_PATH' in build settings, which did not work.
after a lot of messing around, I set these two settings and the build ran on to my physical device.
Goto Xcode,
click on Runner
select Project (top one)
go to Info tab
change configurations for debug
top Runner (green icon) to Generated
Bottom Runner (red circles) Pods-Runner-debug
Basically what happens is that one of the project's 'Build Phases' is running a script:
/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
Now in order to find xcode_backend.sh the FLUTTER_ROOT variable needs to be defined. It is defined in a file called Flutter/Generated.xcconfig, which is generated when you run flutter pub get or flutter build.
The build configuration files Debug.xcconfig and Release.xcconfig (in the same Flutter folder) include Generated.xcconfig.
Now the only thing left is to ensure that for each of the project configurations these build configuration files are properly set (in XCode under Project > Info > Configuration).
use this settings:
Open Xcode - Click on Runner(Top one)
Select the Runner from "PROJECT" Not from "TARGETS"
Select configuration
And update all the modes as this photo
Open Xcode
Click on Runner(Top one)
Select the Runner from "PROJECT" Not from "TARGETS"
Select configuration
And update all the modes for ex: In debug select "debug" configuration set
By Setting FLUTTER_ROOT as the Flutter sdk path solved this issue for me.
Setting runner to Generated in project->Info Configurations seemed to fix it. I can build in xcode now.
The simple solution was to call
flutter clean
flutter run
and then run the app from Xcode.
If changing the configuration as suggested above doesn't fix things
In your Build Phase scripts / Xcode Project change
$FLUTTER_ROOT/packages/flutter_tools/...
to
${FLUTTER_ROOT}/packages/flutter_tools/...
Did the trick for me after the upgrade to the new version of flutter broke the Build.
i have this intermittently while setting up flavors havent got an answer on fixing it but the best explanation of the trail is here https://github.com/flutter/flutter/issues/49495
What helped me was going under PROJECT -> Info -> Configurations
setting the following:
Debug:
Runner - None
fRunner - Debug
Release:
Runner - None
fRunner - Release
Profile:
Runner - None
fRunner - Generated
What worked for me was:
Removing my project ios folder.
(Save it elsewhere, as you will probably want to keep your Info.plist file and Podfile.)
Run flutter create . to build a new ios folder.
Replace new Info.plist and Podfile with originals.
(If you have firebase in your app as I did you likely will have to go into xcode and right-click on runner, add files to runner, and add your GoogleService-Info.plist)
flutter clean , flutter run
I tried all solutions but no one worked :( , I think there is a something missing in the flutter folder so the fast simple solution is ;)
delete flutter folder
Download the stable branch straight from GitHub instead of using an archive (url: https://docs.flutter.dev/get-started/install/macos)
git clone https://github.com/flutter/flutter.git -b stable
Verify that the flutter/bin directory is in your PATH by running
echo $PATH
flutter upgrade
flutter config enable-ios
flutter config enable-android
flutter doctor --android-licenses
flutter doctor -v
cd path/your_project_name
flutter run ios -t lib/main.dart

I can run the IOS emulator but project is not present

Unfortunately, I've deleted my react native project with Xcode may it be the .xcworkspace file or .xcodeproj. file
So in order to get my project back with .xcodeproj, I had to rename my project eject and update react native. Having said that I am able to load the emulator but the project is still not present in the emulator. How do I reintegrate it back?
Here is the error that is seen on terminal:
error Failed to build iOS project.
We ran "xcodebuild" command but it exited with error code 65.
To debug build logs further, consider building your app with Xcode.app,
by opening Project.xcodeproj

Location of gradle binary/wrapper to add to PATH on Mac

I am trying to use Ionic on Mac, but building to an android emulator target and not just running the browser version. The Cordova docs indicate that Android Studio should have everything, and indeed there are all the relevant wrappers etc. there:
$ ls ../AndroidProjects/
AndroidProjects.iml gradle local.properties
app gradle.properties settings.gradle
build gradlew
build.gradle gradlew.bat
But somehow I can't figure out what to add to my PATH to get a project in a different directory to find that stuff, and I don't want to download gradle itself.
$ ionic cordova emulate android
<stuff>
(node:56809) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: 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
Even if I explicitly put the Android Studio project folder in my path, this happens. Weirdly, the final message is still
[OK] Your app has been deployed.
This does not appear to be this question or this question.

Nativescript building android errors

I have a nativescript (3.0) application which I am developing on mac (ElCapitan). I am able to run the iOS emulator without a problem, but I cannot find a way to build the app for Android. I am getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'MyApp'.
> Flavor 'nativescript-telerik-ui' has unknown dimension 'nativescript-telerik-ui'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.004 secs
Command ./gradlew failed with exit code 1
I followed the nativescript documentation strictly, removed the android platform and added it again, reinstalled the Android SDK and tools, but without any success.
At this point I am out of ideas. Any help would be greatly appreciated.
Thank you.
did you try nuke it?
tns plugin remove nativescript-telerik-ui
tns plugin add nativescript-telerik-ui
my be you have an older version
It seems you have changed something on the "AndroidManifest.xml" file and which is not correct. Please fix the "AndroidManifest.xml" file.
If not, you can try this
tns platform remove android
tns platform add android
if only these two lines are not enough for the solution, you may run the android platform on Android Studio.
app/platforms/android
This is the directory, you have to open on Android Studio. After opening this, Android Studio will suggest to you what you have to do.

gradlew.bat failed with exit code 1

i am very new to nativescript, i try to build my first app in nativescript, but it shows
=============================================================================
C:\Nativescript\Grab1>
C:\Nativescript\Grab1>tns prepare android
Executing before-prepare hook from C:\Nativescript\Grab1\hooks\before-prepare\na
tivescript-dev-android-snapshot.js
Preparing project...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
s.
FAILURE: Build failed with an exception.
What went wrong:
org/slf4j/impl/StaticLoggerBinder
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
Processing node_modules failed. Error: Command C:\Nativescript\Grab1\platforms\a
ndroid\gradlew.bat failed with exit code 1
C:\Nativescript\Grab1>
================================================================================
here i attached my command prompt screen shot also, please help me to solve this problem friends
It seems some files missing in platform -> android folder. I fixed this issue by removing the android platform and adding it again by using the below command:
Make sure you are in project directory.Then try this below two commands:
tns platform remove android
tns platform add android
Same way for IOS:
tns platform remove ios
tns platform add ios
Just in case if someone out there is having the same problem on MacOS systems
tns platform remove iOS
tns platform add iOS
Just delete the platform folder from the root directory of the project and run
tns run android
I guess Gradle keeps the history logs which is creating the error. So we need to delete that and rebuild the project.

Resources