简体   繁体   English

签署我的 Flutter 应用程序时,我无法构建该应用程序 *已编辑 *

[英]When signing my flutter app i cannot build the app *edited*

So i want to publish my flutter app to the play store.所以我想将我的 Flutter 应用发布到 Play 商店。 I signed the app but after that the app won't build.我签署了该应用程序,但之后该应用程序将无法构建。 When i try to build my app through the appbundle it returns this:当我尝试通过 appbundle 构建我的应用程序时,它会返回:

C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\tab>flutter build appbundle
Initializing gradle...                                              1,1s
Resolving dependencies...                                           5,6s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done                        11,9s
Gradle task bundleRelease failed with exit code 1

When i try to build the app through fat APK i get a longer error but still a mystery:¨当我尝试通过胖 APK 构建应用程序时,出现更长的错误,但仍然是个谜:¨

C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\tab>flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle...                                              1,4s
Resolving dependencies...                                          23,0s
Note: C:\Users\tbsvst18tedbom\Desktop\Appen\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_admob-0.9.0+9\android\src\main\java\io\flutter\plugins\firebaseadmob\AdRequestBuil
derFactory.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\tbsvst18tedbom\Desktop\Appen\Flutter\flutter\.pub-cache\hosted\pub.dartlang.org\url_launcher-5.2.5\android\src\main\java\io\flutter\plugins\urllauncher\WebViewActivity.jav
a uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Running Gradle task 'assembleRelease'...

Running Gradle task 'assembleRelease'... Done                     133,5s (!)
Gradle task assembleRelease failed with exit code 1

I'll add the app-level build.gradle file if that helps.如果有帮助,我将添加应用程序级 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 FileNotFoundException()("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"

android {
    signingConfigs {
        release {
            storeFile file('C:\\Users\\tbsvst18tedbom\\Desktop\\Appen\\KeyStore\\TABKEY.jks')
            storePassword '***'
            keyAlias = 'TABTRUTH1'
            keyPassword '***'
        }
    }
    compileSdkVersion 29

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.tab.tab"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode = flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.release
    }

    buildTypes {
        release {
            multiDexEnabled true
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.pro'
        }
    }
}

    flutter {
        source '../..'
    }

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.60"
        testImplementation 'junit:junit:4.13-rc-1'
        androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
        implementation 'com.google.firebase:firebase-ads:18.3.0'
        implementation 'com.google.firebase:firebase-appindexing:19.0.0'
        implementation 'com.google.android.gms:play-services-ads:18.3.0'
    }

apply plugin: 'com.google.gms.google-services'  // Google Play services Gradle plugin

I hope that anyone can help me with this weird error message.我希望任何人都可以帮助我解决这个奇怪的错误消息。 I have no idea what so ever of what the problem may be since the app built fine just before I signed it.我不知道问题可能是什么,因为在我签署之前应用程序构建良好。

If you need any files just say the word and I'll edit the question.如果您需要任何文件,只需说出这个词,我就会编辑问题。

Thank you so much!非常感谢!

EDIT1 As requested, this is the pubspec.yaml file EDIT1 根据要求,这是 pubspec.yaml 文件

name: tab
description: TAB2

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  url_launcher: ^5.0.0
  firebase_admob: ^0.9.0+9
  firebase_core: ^0.4.2
  firebase_analytics: ^5.0.6


dev_dependencies:
  flutter_launcher_icons: "^0.7.3"

  flutter_test:
    sdk: flutter

flutter_launcher_icons: "^0.7.3"

flutter_icons:
  android: true
  ios: true
  image_path: "Images/Logo_utan_text.png"

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - Images/logotype.png
    - Images/Logo_utan_text.png

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

After further investigation, I found the build it created.经过进一步调查,我找到了它创建的构建。 The folder is there with all info but there is no APK.该文件夹包含所有信息,但没有 APK。 I belive that the apk fails to be signed so therefore it does not get created?我相信 apk 没有被签名所以它没有被创建? Correct me if im wrong.如果我错了纠正我。

Thank you!谢谢!

EDIT3 When I run gradle sync i get this gradle issue EDIT3 当我运行 gradle sync 时,我遇到了这个 gradle 问题

INFO: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Affected Modules: app

Does anyone know what to do to fix this?有谁知道如何解决这个问题?

Flutter made a guide on how to sign an app which worked for me. Flutter 制作了一个关于如何签署对我有用的应用程序的指南。 You should give it a try.你应该试一试。

Option 1:选项1:

Kotlin Compiler settings. Kotlin 编译器设置。

You can find that setting here: File -> Settings -> Kotlin Compiler -> Target JVM Version您可以在此处找到该设置:文件 -> 设置 -> Kotlin 编译器 ->目标 JVM 版本

Option 2:选项 2:

Update Kotlin Plugin更新 Kotlin 插件

I could be that your IDE has an older level of the Kotlin plugin.我可能是你的 IDE 有一个旧级别的 Kotlin 插件。

Within Android Studio, got to File > Settings... > Kotlin and check to make sure your plugin is up to date.在 Android Studio 中,转到File > Settings... > Kotlin并检查以确保您的插件是最新的。 You may see something like this, indicating you need to update:您可能会看到类似这样的内容,表明您需要更新:

在此处输入图片说明

Also, if you run into memory issues, you may need to add org.gradle.jvmargs=-Xms1024m -Xmx4096m to the gradle.properties file.此外,如果您遇到内存问题,您可能需要将org.gradle.jvmargs=-Xms1024m -Xmx4096m添加到gradle.properties文件中。

It appears as if I had named the keyAlias wrong, it works now that I have changed it.好像我把 keyAlias 命名错了,现在我已经改变了它。 Thank you so much for all the help.非常感谢大家的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我“让 Google 创建和管理我的应用签名密钥”时,应用签名密钥的有效期是多久? - How long is validity of app signing key when I 'Let Google create and manage my app signing key'? 签署我的应用程序后,GOOGLEAPIS地方不起作用 - GOOGLEAPIS PLACES NOT WORKING WHEN SIGNING MY APP Flutter应用程序签名问题— FormatException - Flutter App signing Problem — FormatException Flutter android 签名发布后尝试调试时应用程序崩溃 - Flutter android App crashes when trying to debug after signing release 通过contentobserver添加/删除/编辑联系人时通知我的应用 - notifying my app when a contact is added/deleted/edited through contentobserver 我的第一个 Flutter 应用程序构建中的文本字段问题 - Problem with textfield in my first Flutter app build 当我想在 Flutter 中调试我的应用程序时遇到问题 - I have problem when I want debug my app in Flutter 无法使用我用于签名APK的现有密钥对应用包进行签名 - Cannot sign app bundle with an existing key I use for signing APKs 当我尝试运行时,我的 Flutter 应用程序没有出现在模拟器中 - My Flutter app doesnt appear in the emulator when I try to run it 运行我的颤振应用程序时显示白色空白屏幕 - White blank screen is displayed when I run my flutter app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM