flutter TLS protocol versions: (TLSv1.2, TLSv1.3)
flutter在运行android版本时报错。
报错信息
核心信息
The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3)
Remote host terminated the handshake
全部报错信息
flutter run -d c2b212eb0806 [11:01:41]
Launching lib/main.dart on Redmi 8A in debug mode...FAILURE: Build failed with an exception.* What went wrong:
A problem occurred configuring project ':permission_handler_android'.
> Could not resolve all files for configuration ':permission_handler_android:classpath'.> Could not resolve org.checkerframework:checker-qual:3.12.0.Required by:project :permission_handler_android > com.android.tools.build:gradle:8.0.0 > org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2> Skipped due to earlier error> Could not resolve org.checkerframework:checker-qual:3.12.0.> Could not get resource 'https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.pom'.> Could not GET 'https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.pom'.> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties> Remote host terminated the handshake> Could not resolve com.android:signflinger:8.0.0.Required by:project :permission_handler_android > com.android.tools.build:gradle:8.0.0 > com.android.tools.build:builder:8.0.0> Could not resolve com.android:signflinger:8.0.0.> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/signflinger/8.0.0/signflinger-8.0.0.pom'.> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/signflinger/8.0.0/signflinger-8.0.0.pom'.> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties> Remote host terminated the handshake> Could not resolve com.android:signflinger:8.0.0.> Could not get resource 'https://repo.maven.apache.org/maven2/com/android/signflinger/8.0.0/signflinger-8.0.0.pom'.> Could not GET 'https://repo.maven.apache.org/maven2/com/android/signflinger/8.0.0/signflinger-8.0.0.pom'.> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties> Remote host terminated the handshake> Could not resolve com.android.tools.analytics-library:tracker:31.0.0.Required by:project :permission_handler_android > com.android.tools.build:gradle:8.0.0 > com.android.tools.build:builder:8.0.0> Could not resolve com.android.tools.analytics-library:tracker:31.0.0.> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/31.0.0/tracker-31.0.0.pom'.> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/31.0.0/tracker-31.0.0.pom'.> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties> Remote host terminated the handshake> Could not resolve com.android.tools.analytics-library:tracker:31.0.0.> Could not get resource 'https://repo.maven.apache.org/maven2/com/android/tools/analytics-library/tracker/31.0.0/tracker-31.0.0.pom'.> Could not GET 'https://repo.maven.apache.org/maven2/com/android/tools/analytics-library/tracker/31.0.0/tracker-31.0.0.pom'.> The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.5/userguide/build_environment.html#gradle_system_properties> Remote host terminated the handshake> Could not resolve com.android.tools.build:manifest-merger:31.0.0.Required by:project :permission_handler_android > com.android.tools.build:gradle:8.0.0 > com.android.tools.build:builder:8.0.0> Could not resolve com.android.tools.build:manifest-merger:31.0.0.
原因分析
🧱 使用了 旧版的 JDK(如 JDK 8),但服务器要求 TLS 1.2/1.3;
解决办法
我把jdk8换成了jdk11就解决了。