1

After change minSdkVersion from 16 to 19 on old android devices eg. Android 5.1.1, Android 6 I install app but can't load data from web rest api. On Android 11 all work fine.

I'm change version because some plugin need min sdk 19.

Which android version my app now supports?

android { compileSdkVersion 30 defaultConfig { applicationId "com.example.test" minSdkVersion 19 targetSdkVersion 30 } 

My sdk manager: enter image description here

Console log when run app on Android 6 emulator.

D/PathProviderPlugin( 4466): Don't use TaskQueues. I/FLTFireMsgService( 4466): FlutterFirebaseMessagingBackgroundService started! E/flutter ( 4466): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: HandshakeException: Handshake error in client (OS Error: E/flutter ( 4466): CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:359)) E/flutter ( 4466): #0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:104:46) E/flutter ( 4466): #1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:147:25) E/flutter ( 4466): #2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:794:54) E/flutter ( 4466): #3 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:924:19) E/flutter ( 4466): <asynchronous suspension> E/flutter ( 4466): 
1
  • just curious, do you see any error or warning log on logcat when you changed the ask to 19? Commented Dec 7, 2021 at 13:33

2 Answers 2

1

In main.dart file I'm add:

import 'dart:io';

class MyHttpOverrides extends HttpOverrides{ @override HttpClient createHttpClient(SecurityContext? context){ return super.createHttpClient(context) ..badCertificateCallback = (X509Certificate cert, String host, int port)=> true; } } --Add before runApp(MyApp()); HttpOverrides.global = MyHttpOverrides(); runApp(MyApp()); 
Sign up to request clarification or add additional context in comments.

Comments

0

Follow this -> https://github.com/dart-lang/http/issues/627#issuecomment-1824426263

It solves the problem for me

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.