The trap I have met in flutter
1.Flutter App stuck at "Running Gradle task 'assembleDebug'... " on Android
- Open your flutter Project directory.
- Change directory to android directory in your flutter project directory
cd android - clean gradle
./gradlew clean - Build gradle
./gradlew buildor you can combine both commands with just./gradlew clean build - Now run your flutter project. If you use vscode, press F5. First time gradle running assembleDebug will take time.
PS: Delete gradle in case of all that steps don't work
2024.3.4
2.Flutter App stuck at "Installing build/app/outputs/flutter-apk/app-debug.apk..." on Android
Delete the App on your android and restart your flutter project.
2024.3.4
3.Demostrate a picture with flutter app on macOS
I get the following error:
The following SocketException was thrown resolving an image codec:
Connection failed (OS Error: Operation not permitted, errno = 1), address = my_website.top, port = 80macOS needs you to request a specific entitlement in order to access the network. To do that open macos/Runner/DebugProfile.entitlements and add the following key-value pair.
<key>com.apple.security.network.client</key>
<true/>Then do the same thing in macos/Runner/Release.entitlements.
You can read more about this in the Desktop support for Flutter documentation.
2024.3.26
4.I can't send network request with flutter app on macOS
I was trying to implement a login function but it said Connection Failed.
I use the following command to check and found it wasn't the server's problem.
curl -X POST http://your-server-ip:3000/login -H "Content-Type: application/json" -d '{"username":"admin","password":"password"}'So I decided to check settings of client. Then I realize that macOS is strict with the network permissions.
Open macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements. Add the following key-value pairs in order to allow the app to connect network.
<key>com.apple.security.network.client</key>
<true/>2024.6.2