error generated by flutter while deploying an app - gradle

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.

Related

My KMM project won't run on an iPhone emulator

I have a KMM project which runs perfectly on android, however when I open the project on Xcode for the IOS portion and try to run it on an emulator it does not compiler throwing the following error:
BUILD FAILED in 3s
Command PhaseScriptExecution failed with a nonzero exit code
What went wrong:
Task 'embedAndSignAppleFrameworkForXcode' not found in project ':shared'.
The app does run on my physical iPhone.
I have two questions:
How do I fix this?(if there is a fix)
Can I confidently work on my project without the emulator or should I take this error as a sign that there is something wrong with my project to the point of concern?
Kotlin Version: 1.5.31
Running on Mac with M1
using SQLDelight and Serialization dependencies.

i try to use map view in my flutter app and got some errors

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.

Flutter Install Gradle Issues

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'
}}

Gradle in the mac's idea, build sync failed

Created a gradle project with idea2017 for mac, when refresh all gradel projects, build:sync failed
java version: 1.8.0
gradle version: 4.4
Error: Could not find or load main class .Library.Java.JavaVirtualMachines.jdk1.8.0_152.jdk.Contents.Home
How can I build it?
Thanks.
I have already set JAVA_HOME

xcode build fails with error code 65 without indicative message

I'm experiencing weird behaviour with my iPhone CI job (running in TeamCity). Every once in a while our build fails without any indicative error in the build log. The build reaches the last stage of codesign validation and I get ** BUILD FAILED ** message immediately after.
These are the last lines of the log of a good and bad builds -
Bad Build
[15:00:56] : [CodeSign] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Library/TeamCity/buildAgent/work/dc055fa257f562be/DerivedData/MyProject/Build/Products/AdHoc-iphoneos/MyProject.app
[15:00:58]W: [Step 3/6] ** BUILD FAILED **
Good Build
[14:09:13] : [CodeSign] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/Validation /Library/TeamCity/buildAgent/work/dc055fa257f562be/DerivedData/MyProject/Build/Products/AdHoc-iphoneos/MyProject.app
[14:09:13] : [Step 3/6] ** BUILD SUCCEEDED **
Because it's running in a CI I looked for user interaction problems (opening the keychain...etc') but usually xcodebuild spews the relevant errors.
Is there any other log I can dig into to find the cause of the build failures?
EDIT:
Seems I had the same problem like build failed jenkins iOS no error.
I also had a similar problem, in my case it was caused by the fact I'm using both Xcode 7.2 and Xcode 6.4 side by side. When the simulator of Xcode 6.4 is open (iOS Simulator 8.4) and I try to start a test from the commandline using Xcode 7.2 I get this 65 error.
Eg. when iOS Simulator 8.4 is open:
# sudo xcode-select -s "/Applications/Xcode 7.2.app/Contents/Developer"
# xcodebuild test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -workspace "/path/to/MyWorkspace.xcworkspace" -scheme "MyProject" -destination "platform=iOS Simulator,name=iPhone 6,OS=9.2"
(cut)
** TEST FAILED **
# echo $?
65
Solution is to kill the simulator before starting the test:
# killall "iOS Simulator"
# killall "Simulator"
The process is called "iOS Simulator" for XCode 6.4 and earlier and called "Simulator" for later XCode versions.
Had the same problem as build failed jenkins iOS no error
tl;dr - CopyPNG failed because of two images with the same name.
You need to remove platform ios - cordova platform rm ios, and then add platform - cordova platform add ios. now build ios - cordova build ios
I hit this when updating to Xcode 8, in my case it was because I had set the PROVISIONING_PROFILE_SPECIFIER setting incorrectly
For Xcode version 13
The following is what worked for me, this is aimed at Xcode version 13, hoping to be helpful
My React native project was cloned, i was able to run the app in android, but while running on iOS it showed error code 65.
After trying most of the solutions and failing, i got it fixed finally. This is what worked for me, and could be useful for some people hopefully.
Clone the project again(not necessary, just telling you what was done)
npm install
pod install (in iOS directory)
If Xcode shows error code 65, if there is legacy deprecation issue --> go to Xcode -->file --> workspace settings --> Check the box at the end of the window saying "do not show diagnostic issue about build system deprecation
run the project again
This is what fixed it for me.
My issue came up after updating to the latest version of Xcode. To resolve, I performed the following steps.
Completely quit Xcode and the Simulator. I had a zombie Simulator process running that I found and closed through Activity Monitor. Be sure no processes for Xcode or Simulator are running.
In Xcode, open the project found in the ios folder of your react-native project.
Xcode may suggest some recommended updates to modules. I accepted their recommendations.
Close Xcode, relaunch your react-native app

Resources