How to fix connectivity pugin error on runtime? - dart

The application running well-using flutter run
But
using flutter build apkand flutter install app is not running well.
in terminal error message showing
Initializing gradle... 1.4s
Resolving dependencies... 2.3s
Red color test below
Note: /Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/connectivity-0.4.2+1/android/src/main/java/io/flutter/plugins/connectivity/ConnectivityPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Related

Codemagic build process for a Flutter app: Could not find a file named "pubspec.yaml"

I am using Codemagic for the iOS build process for a Flutter app.
In the pubspec.yaml I am referring to a package dependency by pointing to a public repository like so:
dependencies:
flutter:
sdk: flutter
flutter_circular_slider:
git: https://github.com/tomoehlrich/flutter-circular-slider.git
It all works with local debugging and when building an apk with "flutter build apk" on Windows.
Codemagic though keeps giving me the following error message in the build step "Installing dependencies":
== Install Flutter dependencies ==
> flutter packages pub get
Resolving dependencies...
Could not find a file named "pubspec.yaml" in https://github.com/tomoehlrich/flutter-circular-slider.git 5d6d0c54e93766b27d30707bf20042b26894561c.pub
finished with exit code 1
Build failed :|Failed to install dependencies
I had Codemagic working before. The difference now to the working version was that I was referencing a different repository on Github.
I am trying to figure out why the build process cannot find the pubspec.yaml in https://github.com/tomoehlrich/flutter-circular-slider.git but in another fork of the same flutter package on Github.
Any hints are highly appreciated.
It seems that "resolved-ref" in pubspec.lock for the slider package was an outdated reference.
A new generation of pubspec.lock, sync to GitHub and start a new build process in Codemagic did the trick.

Flutter: error Xcode: command PhaseScriptExecution failed with a nonzero exit code

I tried to run flutter after updating to the newest stable version
Error output from Xcode build:
↳
** BUILD FAILED **
Xcodes output:
↳
Writing result bundle at path:
/var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle
/usr/local/Caskroom/flutter/2.5.2/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib/src/interface/local_platform.dart:46:19: Error: Member not
found: 'packageRoot'.
io.Platform.packageRoot; // ignore: deprecated_member_use
^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
Result bundle written to path:
/var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 13 Pro.
I've tried flutter clean and flutter pub get but that isn't the fix. Anyone any idea how to fix this?
As i see you are currently using flutter 2.5.2 which is newest,So Update you flutter SDK by running command
flutter upgrade
Then Upgrade the current package's dependencies to latest versions by running command
flutter pub upgrade
Go to iOS folder of the project run
pod init
and
pod install
I hope this solution solve your problem.
Please up the vote if this answer help you.
I spent way too much time on this issue.
For me the problem was related to the Flutter cache and running the following command resolved the issue:
flutter pub cache repair
The solution made sense to me when I noticed a plugin trying to reference [flutter-sdk-path]/flutter/packages/flutter/lib/screens.dart--which did not exist in my Flutter SDK.
Ref: Update flutter dependencies in /.pub-cache
Guys, sometimes it better to just GO TO SLEEP! It helps a great deal to have fresh eyes looking at a problem.
if you have Podfile in iOS folder
Go to iOS folder of the project
run
flutter clean
and
flutter pub get
and
pod update

How to fix cocoa pods flutter bug?

I am trying to run several dependencies on my flutter project however end up always getting the same error while running the project on ios and the full terminal message looks like this:
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/username/Desktop/flutter_test/xylophone/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'assets_audio_player/AssetsAudioPlayerPlugin.h' file not found
#import <assets_audio_player/AssetsAudioPlayerPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.
Launching lib/main.dart on iPhone X in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.dev/platform-plugins
To install:
brew install cocoapods
pod setup
Xcode build done. 5.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Exited (sigterm)
This occurs with every dependency that I try to use from the flutter packages and I really don't know how to fix this. The process of installing cocoapods also doesn't work.
This has an existing GitHub issue. The error you've encountered was because the time you've installed cocoapods, it was installed with different version of ruby than you currently have active.
The recommended way to fix this is to to uninstall your existing cocoapods brew uninstall cocoapods and install a fresh one, via sudo gem install cocoapods.

Failing to build an iOS app built using Cordova / Ionic using Azure DevOps

Trying to build an iOS app built using Ionic / Cordova on Azure DevOps
Getting this error:
Using cordova-fetch for cordova-ios#^5.0.0
Failed to fetch platform cordova-ios#^5.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: Cannot find module 'UNMET/package.json' from '/Users/vsts/agent/2.148.2/work/1/s'
[ERROR] An error occurred while running subprocess cordova.
I am using a simple setup using the following steps:
Agent: Hosted macOs
npm install
Ionic Command [ionic version: 4.12.0; Cordova Version: default]
Publish Build Artifacts
We had the same problem, and the solution was to make sure all NPM dependencies were met.
Check the logs for the npm install step and see if there are any unmet dependencies there and add/update missing depedencies in your package.json file.

VSTS Cordova iOS build on MacinCloud agent failed - "Cannot read property 'fail' of undefined"

I have VSTS build, that suppose to build iOS apps.
It runs on MacinCloud build agent, and uses "Cordova Build" step.
It wokred, but for some reason I started to receive some very informational exception - "Cannot read property 'fail' of undefined"
TypeError: Cannot read property 'fail' of undefined
at /Users/vso113516/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/src/plugman/fetch.js:168:17
at _fulfilled (/Users/vso113516/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/vso113516/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/vso113516/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:749:13)
at /Users/vso113516/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:509:49
at flush (/Users/vso113516/.taco_home/node_modules/cordova/8.0.0/node_modules/cordova-lib/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
Does anyone have any idea what should I look on to solve the problem?
Please, if you need more information, I'll provide it via question updates.
Try to downgrade to cordova version 7.1.0 (windows & ios). In the Cordova Build step, modify the 'Cordova Version' setting.
npm install -g cordova#7.1.0
and
$sudo npm install -g cordova#7.1.0
I've faced this same issue after upgraded to version 8.0.0 (even with the "Blank App" project).
I have faced the same issue I resolved it by creating taco.json in the project root, specifying "cordova-cli" version like below:
{
"cordova-cli": "8.0.0"
}
As specified in https://github.com/Microsoft/taco-team-build#configureconfig, I was building it for android BTW. However, it seems this might help you as well.

Resources