Android Studio 连接已关闭:javax.net.ssl.SSLException:标签不匹配

vfh0ocws  于 2023-01-02  发布在  Android
关注(0)|答案(2)|浏览(317)

以前有人遇到过这个错误吗?我是flutter的新手,在运行flutter的示例文件时有什么问题吗?堆栈跟踪给了我3个错误,如:***线程"main"中出现异常javax.net.ssl。连接已关闭: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医生总结

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.

当我运行任何项目时,我面临着同样的一堆错误。任何帮助都将不胜感激。谢谢:)

1cklez4t

1cklez4t1#

尝试更新android studio和相应的flutter和dart sdk。然后进入sdk管理器并更新构建工具。重新启动IDE和模拟器,flutter现在应该可以工作了。

disho6za

disho6za2#

这是gradle版本错误,因此请将gradle分发URL更改为distributionUrl=https:services.gradle.org/distributions/gradle-6.5-all.zip

相关问题