Flutter - http.get fails on macos build target: Connection failed - http

I started porting my Flutter app to macos Desktop. The UI started fine. However, as soon as the app makes a network call, it fails instantly with Connection failed (OS Error: Operation not permitted).
Running a one-liner:
final response = await http.get('https://jsonplaceholder.typicode.com/posts/1');
fails with:
Unhandled Exception: SocketException: Connection failed (OS Error:
Operation not permitted, errno = 1),
address = jsonplaceholder.typicode.com, port = 443
#0 IOClient.send (package:http/src/io_client.dart:33:23)
The macos build target comes from Google's sample here.
Flutter (Channel master, v1.9.8-pre.108)

Per my comment on the other answer, you should not use the Xcode capabilities UI for this. It will not correctly handle the two separate entitlement files in a Flutter project.
You need to add:
<key>com.apple.security.network.client</key>
<true/>
to macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements.
This is documented here and here.

Your macOS XCode project lacks Internet permission called "Outgoing Connections (Client)".
Open your macos xcode project - [root]/macos/Runner.xcworkspace
Click "Runner" in Project navigator - general settings will show up. Select "Capabilities" from tabbar and tick option "Outgoing Connections (Client)".
Rebuild your application inside XCode and launch the project.

If you are getting this error Only in Android release then Internet permission must be missing from main manifest. You just need to add Internet permission in Manifest file.
Just add this permission in manifest <uses-permission android:name="android.permission.INTERNET"/>
There are three manifest file available in Android folder
app/src/debug
app/src/main
app/src/profile

Related

I can't configure MacOS project to work with Firebase

I have added the GoogleService-info-plist to the project.
I have checked and both the MacOs project and the Firebase's project have the same BundleID.
I also had donde several projects with iOS/SWiftUI and Firebase with no issues.
This is the first time I'm trying to connect Firebase to a MacOs project.
I have also deleted the GoogleService-info-plist file from the MacOs project, downloaded it again and added it via the XCode project/Add file process but I'm still getting this crash message...
2022-01-13 11:03:44.260253-0500 WebScraper[33494:19053189] 8.10.0 - [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2022-01-13 11:03:44.268425-0500 WebScraper[33494:19052756] *** Terminating app due to uncaught exception 'com.firebase.core', reason: 'FirebaseApp.configure() could not find a valid GoogleService-Info.plist in your project. Please download one from https://console.firebase.google.com/.
Any ideas?

After Update to Android Studio Arctic Fox 2020.3.1 Patch 4, Error: Could not resolve aapt2-7.0.4-7396180-windows.jar

After update to Android Studio Arctic Fox 2020.3.1 Patch 4,
Error: Could not resolve aapt2-7.0.4-7396180-windows.jar (com.android.tools.build:aapt2:7.0.4-7396180): No cached version
Execution failed for task ':app:processDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform viewbinding-7.0.4.aar (androidx.databinding:viewbinding:7.0.4) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
.
.
Possible solution:
- Disable offline mode and rerun the build
if I disable offline mode and syn the project again. Then even its not building the project then errors comes again.
Error after disabling offline mode:
:app:writeDebugSigningConfigVersions
FAILURE: Build completed with 8 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.cuberto:liquid-swipe:1.0.0.
Required by:
project :app
> Could not resolve com.cuberto:liquid-swipe:1.0.0.
> Could not get resource 'https://dl.bintray.com/amulyakhare/maven/com/cuberto/liquid-swipe/1.0.0/liquid-swipe-1.0.0.pom'.
> Could not HEAD 'https://dl.bintray.com/amulyakhare/maven/com/cuberto/liquid-swipe/1.0.0/liquid-swipe-1.0.0.pom'. Received status code 502 from server: Bad Gateway
.
many errors
.
.
Could not HEAD 'https://dl.bintray.com/amulyakhare/maven/com/cuberto/liquid-swipe/1.0.0/liquid-swipe-1.0.0.pom'. Received status code 502 from server: Bad Gateway
Disable Gradle 'offline mode' and sync project
even offline mode is deactivated.
What's wrong with it?
Even Firebase is not connecting to internet through firebase Assistant though Android Studio.
I found the culprit for this in my project.
Earlier I was using in all projects repositories in build.gradle(Exam String)
maven {
url 'https://dl.bintray.com/amulyakhare/maven'
}
In earlier Android studio versions, it was working using this repositories.
After removing this from build.gradle(Exam String).
It started working fine.
It is used for liquide swipe view pager.
For reference I have added screenshot of repositories.

After Realm Java upgrade and downgrade, crash with RealmFileException: Unsupported Realm file format version. line 101 Kind: ACCESS_ERROR

I upgraded Realm version from io.realm:realm-gradle-plugin:5.1.0 to 10.8.1 with no issue. However, then I had to test an earlier version of my app, so I completely uninstalled the app that used 10.8.1 from the phone and reinstalled the app that used Realm 5.1.0. I then get a crash when opening a Realm for the first time with the following error:
io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.my.app/files/fileName.realm':
Unsupported Realm file format version. (Unsupported Realm file format version) (/data/data/com.my.app/files/fileName.realm)
in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp
line 101 Kind: ACCESS_ERROR.
It's like the file already exists, even after a fresh install.
I fixed this by adding Realm.delete(configuration) when the app - the one using 5.1.0 - first started just to manually delete the file the exception was complaining about. Then I removed the Realm.delete line and did another fresh install. Everything worked fine after that.

Error staging application: App staging failed in the buildpack compile phase in HWC Buildpack

I am trying to deploy my application built in ASP.Net 4.6.1. So I am using HWC Buildpack.
Below is my manifest.yml
---
applications:
- name: DRSN
random-route: true
memory: 128M
buildpack:
https://github.com/cloudfoundry/hwc-buildpack.git
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
The error that I am receiving is below.
Waiting for API to complete processing files...
Staging app and tracing logs...
Cell 0f7012eb-9e32-4fdf-ba92-85aee4639139 creating container for instance 34107c3c-1acb-4aa5-b435-b06516abcfcb
Cell 0f7012eb-9e32-4fdf-ba92-85aee4639139 successfully created container for instance 34107c3c-1acb-4aa5-b435-b06516abcfcb
Downloading app package...
Downloading build artifacts cache...
Downloaded build artifacts cache (231B)
Downloaded app package (19.5M)
Failed to compile droplet: Failed to compile droplet: fork/exec /tmp/buildpackdownloads/6c6dca8d638ac0d145d6581f9eb9a96a/bin/compile: permission denied
Exit status 223
Cell 0f7012eb-9e32-4fdf-ba92-85aee4639139 stopping instance 34107c3c-1acb-4aa5-b435-b06516abcfcb
Cell 0f7012eb-9e32-4fdf-ba92-85aee4639139 destroying container for instance 34107c3c-1acb-4aa5-b435-b06516abcfcb
Error staging application: App staging failed in the buildpack compile phase
Can anyone help me resolve this issue? Am I not correct in my manifest.yml? Or is it something else?
I believe that the problem is that you're telling the system to use the HWC buildpack, but at the same time you're not setting the Windows stack (at least based on what info I can see). That means it's going to default to the Linux stack, which I believe is why you're seeing the fork/exec /tmp/buildpackdownloads/... error.
Try adding stack: windows to your manifest.yml or -s windows to your cf push command (for future reference, when you need help always include the full cf push command you're running).
PS: you shouldn't use https://github.com/cloudfoundry/hwc-buildpack.git that is telling the system to grab the master branch in whatever state it's currently in. That's a.) not reproducible and b.) not guaranteed to be in a working state. You should either use the platform provided buildpack names (from cf buildpacks) or append #<branch_or_tag> to the end of the URL so it picks a specific branch. All CF Buildpacks have tags for each release. It's strongly recommended you use a tagged release.

VS TACO error "Cannot find the app installed on the device" on iOS device

I'm using VS2015 Update 2 with TACO Update 9 and I'm attempting to debug an application on a iPhone 6S (iOS 9.3.1) attached to my Windows computer. The remote build is successful but I get the following messages when it attempts to debug the app:
2>------ Deploy started: Project: xyz, Configuration: Debug iOS ------
2>Found iTunes version: 12.3.0.44
2>Uninstalling app ID: com.bob.xyz.
2>Successfully installed .ipa file: D:\Documents\Projects\xyz\xyz\bin\iOS\Debug\xyz.ipa.
2>Starting idevicedebugserverproxy.exe at port 3000.
2>Cannot find the app installed on the device. Check that the device is connected, awake, and unlocked.
2>Deployment failed.
When I look on the device, I do not see the application. Are there steps I can take to further debug what might be causing the failure?
Make sure your solution is configured for Debug build and not Release.

Resources