Not working with Android SDK 28
Vardiak opened this issue · 10 comments
Describe the bug
When I try to use this package with Android SDK 28, I get spammed with "web socket error" in the debug console and the socket can't connect. After multiple hours of work trying to merge my application with the example I found out that it worked by replacing compileSdkVersion
and targetSdkVersion
from 28 to 27 in android/app/build.gradle
.
To Reproduce
Update the example to Android SDK 28
Expected behavior
The socket should connect normally.
Here is the same, both 28 and 29
pubspec.lock
adhara_socket_io:
dependency: "direct main"
description:
name: adhara_socket_io
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
build.gradle
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
I had the same problem and I fixed it by adding the following line in the AndroidManifest.xml file inside "application":
android:usesCleartextTraffic="true"
For more info: https://stackoverflow.com/questions/53284903/socket-io-not-working-on-android-9-api-level-28)
Hope this helps.
@GMasciaRDT Thank You, I added and it worked.
Thank you @GMasciaRDT
Project README updated with the necessary help content
thanks! it works.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':adhara_socket_io:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/build/adhara_socket_io/intermediates/res/merged/release/values/values.xml:236: error: resource android:attr/fontVariationSettings not found.
/home/build/adhara_socket_io/intermediates/res/merged/release/values/values.xml:237: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I had the same problem and I fixed it by adding the following line in the AndroidManifest.xml file inside "application":
android:usesCleartextTraffic="true"
For more info: https://stackoverflow.com/questions/53284903/socket-io-not-working-on-android-9-api-level-28)
Hope this helps.
i used these attributes , but its not working giving me same error
io.socket.engineio.client.EngineIOException: websocket error
android:usesCleartextTraffic="true"
i used these attributes , but its not working giving me same error
The plugins adhara_socket_io, flutter_absolute_path, onesignal_flutter
use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on AOSP on IA Emulator in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Failed to create parent directory '/Users/basel' when creating directory '/Users/basel/AndroidStudioProjects/estiqbal/android/app/build/intermediates/flutter/debug/flutter_assets'
-
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 33s
Exception: Gradle task assembleDebug failed with exit code 1
android native for This error has resurfaced. i am getting the same error. I did all the trials. but still the same