无法在Flatter中生成签名apk:任务执行失败“:app:uploadcrashlyticsmappingfilerelease”java.net.socketexception:套接字已关闭

vuv7lop3  于 2021-09-13  发布在  Java
关注(0)|答案(1)|浏览(441)

我一直在开发一款Flutter应用程序,我能够使用android studio对话框成功地构建甚至签署我的apk。为此,我在android studio中打开android文件夹,进入build>generate signed apk。
此操作今天停止工作,并显示以下消息:

> Task :app:uploadCrashlyticsMappingFileRelease FAILED
Execution failed for task ':app:uploadCrashlyticsMappingFileRelease'.
> java.net.SocketException: Socket closed

我的build.gradle如下所示:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "my.app"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        setProperty("archivesBaseName", applicationId + "." + flutterVersionName + "." + flutterVersionCode)
    }

    buildTypes {
        release {
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//            ndk {
//                abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
//            }
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:26.2.0')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-auth-ktx'
}

我很困惑,为什么会这样。在过去的几天里,我只编辑了*.dart文件,根本没有更改android项目。我仍然可以使用build>buildbundle/apk>buildapk构建调试apk。

cgh8pdjw

cgh8pdjw1#

我刚刚重新启动了我的系统,现在一切都恢复正常了,所以没关系。

相关问题