handshakeexception handshake error in client (os error wrong_version_number tls_record cc 242) Flutter app/Node server
Found it..I was missing <uses-permission android:name="android.permission.INTERNET" />
in Cyclist app AndroidManifest.xml
Vincenzo
Updated on December 31, 2022Comments
-
Vincenzo over 1 year
I'm getting an
handshakeexception handshake error in client (os error wrong_version_number tls_record cc 242) error whenever making an http request( I also tried https ) but from only one ( Cyclist app ) of the two Flutter apps that connect to Node.js server. I'm using the same IP address and port on both, the Android tablet on which I'm testing both apps and for my machine. I checked Manifest Android/src/main/AndroidManifest.xml to see if I was using
android:usesCleartextTraffic="true"`on the working app ( Shop app ) but I'm not..What else could I check to see what's causing the error in the Cyclist app??
This is the request:
Map<String, String> headers = { 'Content-Type': 'application/json', 'api_key': Environment.dbApiKey }; // final Uri uri = Uri.https(Environment.dbUrl, '/api/routes'); final Uri uri = Uri.http(Environment.dbUrl, '/api/routes'); await post(uri, headers: headers, body: jsonEncode(route.toMap())) .then((resp) { print( 'RouteMongoRepository.saveRoute response status code is: ${resp .statusCode}, \n response is : ${jsonDecode(resp.body)}'); UserRoute saved = UserRoute.fromMap(jsonDecode(resp.body)['data']); print('saved route to Mongo is : ${saved.toMap().toString()}'); }) .catchError((e) => print('RouteMongoRepository.saveRoute error: $e')) ;
This is the Shop app manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.vinny.fixit_shop_flutter"> <!-- io.flutter.app.FlutterApplication is an android.app.Application that calls FlutterMain.startInitialization(this); in its onCreate method. In most cases you can leave this as-is, but you if you want to provide additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:name="io.flutter.app.FlutterApplication" android:allowBackup="false" android:label="fixit shop" android:icon="@mipmap/ic_launcher"> <activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> </application> </manifest>
and this is the Cyclist app manifest:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <application android:name="io.flutter.app.FlutterApplication" android:allowBackup="false" android:label="fixit" android:icon="@mipmap/ic_launcher"> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize" > <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" /> <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/> </intent-filter> </receiver> <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> </application> </manifest>