以前有人遇到过这个错误吗?我是 flutter 新手,运行我丢失的 flutter 示例文件时是否有任何问题?堆栈跟踪给了我 3 个错误,例如: 线程“主”javax.net.ssl.SSLException中的异常:连接已关闭:javax.net.ssl.SSLException:标签不匹配!和引起:javax.net.ssl.SSLException:标签不匹配! 和 引起:javax.crypto.AEADBadTagException:标签不匹配!
这是我的堆栈跟踪
Exception in thread "main" javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: Tag mismatch!
at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1533)
at sun.security.ssl.AppInputStream.available(AppInputStream.java:60)
at java.io.BufferedInputStream.available(BufferedInputStream.java:410)
at sun.net.www.MeteredStream.available(MeteredStream.java:170)
at sun.net.www.http.KeepAliveStream.close(KeepAliveStream.java:85)
at java.io.FilterInputStream.close(FilterInputStream.java:181)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.close(HttpURLConnection.java:3527)
at org.gradle.wrapper.Download.downloadInternal(Download.java:77)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:61)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: javax.net.ssl.SSLException: Tag mismatch!
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1022)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:933)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.MeteredStream.read(MeteredStream.java:134)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3454)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3447)
at org.gradle.wrapper.Download.downloadInternal(Download.java:62)
... 7 more
Caused by: javax.crypto.AEADBadTagException: Tag mismatch!
at com.sun.crypto.provider.GaloisCounterMode.decryptFinal(GaloisCounterMode.java:592)
at com.sun.crypto.provider.CipherCore.finalNoPadding(CipherCore.java:1116)
at com.sun.crypto.provider.CipherCore.fillOutputBuffer(CipherCore.java:1053)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:941)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:491)
at javax.crypto.Cipher.doFinal(Cipher.java:2376)
at sun.security.ssl.CipherBox.decrypt(CipherBox.java:461)
at sun.security.ssl.InputRecord.decrypt(InputRecord.java:172)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1017)
... 16 more
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 3.0s
Exception: Gradle task assembleDebug failed with exit code 1
以下文件是“main.dart”
import 'package:flutter/material.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
); } }
class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override _MyHomePageState createState() => _MyHomePageState(); }
class _MyHomePageState extends State<MyHomePage> { int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
}); }
@override Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
); } }
Flutter Doctor总结
PS F:\Flutter\chat_app> flutter doctor -v
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 1.22.6 at C:\src\flutter
• Framework revision 9b2d32b605 (4 weeks ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\ShreeDivyangnaRajaji\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.53.2)
• VS Code at C:\Users\ShreeDivyangnaRajaji\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.19.0
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 5.1.1 (API 22) (emulator)
! Doctor found issues in 1 category.
当我运行任何项目时,我都会遇到同样的错误堆栈。任何帮助将不胜感激。谢谢你:)
<uses-permission android:name="android.permission.INTERNET" />
<application ... android:usesCleartextTraffic="true" ...>
我也面临着同样的问题。我只是添加互联网权限并在应用程序级别 androidMainfest.xlm 中使用 CleartextTraffic 为 true
尝试更新android studio以及相应的flutter和dart sdks。然后进入 sdk 管理器并更新构建工具。重新启动你的 IDE 和模拟器,flutter 现在应该可以工作了。
这是 gradle 版本错误,因此更改 gradle distrubution url 到 distributionUrl=https://services.gradle.org/distributions/gradle-6.5-all.zip
我只需使用VPN就解决了这个问题! 由于某种原因,我的本地网络似乎与目标服务器存在连接问题。
从手机接入点切换到 Wifi 解决了我的问题。
我通过热点使用移动数据解决了这个问题。我认为问题出在 Wifi 上。