Firebase_auth 无法在 flutter 上构建发布 apk [firebase_auth: ^0.16.1]

Firebase_auth cannot build release apk on flutter [firebase_auth: ^0.16.1]

描述错误 你好, 我正在做一个与 Firebase 相关的项目并使用最新版本的 firebase_auth: ^0.16.1。 我无法在此包上进行发布构建。 以下是关于我的 flutter doctor 和 error console 的信息。

复制

运行 flutter build apk --release

预期行为

    jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
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,android-x64
        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,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split

FAILURE: Build failed with an exception.                                

* Where:                                                                
Build file '/home/jerald/Documents/myown/flutter-game/Flutter-Apps/Hangman/android/app/build.gradle' line: 46

* What went wrong:                                                      
A problem occurred evaluating project ':app'.                           
> Could not find method signingConfig() for arguments [build_c22a35jnh8wqwng2bpwid9s9i$_run_closure2$_closure7@2634cea7] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.

* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                              

BUILD FAILED in 5s                                                      
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                       7.3s
Gradle task assembleRelease failed with exit code 1
jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ clear
jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
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,android-x64
        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,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split

FAILURE: Build failed with an exception.                                

* Where:                                                                
Build file '/home/jerald/Documents/myown/flutter-game/Flutter-Apps/Hangman/android/app/build.gradle' line: 46

* What went wrong:                                                      
A problem occurred evaluating project ':app'.                           
> Could not find method signingConfig() for arguments [build_c22a35jnh8wqwng2bpwid9s9i$_run_closure2$_closure7@47335095] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.

* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                              

BUILD FAILED in 0s                                                      
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                       1.1s
Gradle task assembleRelease failed with exit code 1
jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ clear
jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
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,android-x64
        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,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split

FAILURE: Build failed with an exception.                                

* Where:                                                                
Build file '/home/jerald/Documents/myown/flutter-game/Flutter-Apps/Hangman/android/app/build.gradle' line: 46

* What went wrong:                                                      
A problem occurred evaluating project ':app'.                           
> Could not find method signingConfig() for arguments [build_c22a35jnh8wqwng2bpwid9s9i$_run_closure2$_closure7@7f548c1c] on object of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.

* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                              

BUILD FAILED in 0s                                                      
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                       1.0s
Gradle task assembleRelease failed with exit code 1
jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ clear
jerald@IN-81:~/Documents/myown/flutter-game/Flutter-Apps/Hangman$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
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,android-x64
        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,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Removed unused resources: Binary resource data reduced from 309KB to 295KB: Removed 4%

FAILURE: Build failed with an exception.                                

* What went wrong:                                                      
Execution failed for task ':screenshot_and_share:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  Output:  /home/jerald/Documents/myown/flutter-game/Flutter-Apps/Hangman/build/screenshot_and_share/intermediates/res/merged/release/values/values.xml:186: error: resource android:attr/fontVariationSettings not found.
  /home/jerald/Documents/myown/flutter-game/Flutter-Apps/Hangman/build/screenshot_and_share/intermediates/res/merged/release/values/values.xml:187: error: resource android:attr/ttcIndex not found.
  error: failed linking references.                                     

Apps/Hangman/build/screenshot_and_share/intermediates/res/compiled/release/values-tr_values-tr.arsc.flat\
          --auto-add-overlay\                                           
          --non-final-ids\                                              
          -0\                                                           
          apk\                                                          
          --no-version-vectors                                          
  Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #0                    

* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                              

BUILD FAILED in 1m 55s                                                  
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                     117.5s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin firebase_auth...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                    3.2s


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'firebase_auth'.
> The SDK directory '/home/jerald/Android/sdk' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s


The plugin firebase_auth could not be built due to the issue above.

flutter博士资料

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Linux, locale en_IN)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Android Studio (version 3.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.36.1)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

按照以下步骤操作:

  1. 你打开 flutter doctor 并输入 flutter doctor。

  2. flutter 医生 - Android 执照。

  3. 你有两个选项 y / N,你输入 Y,然后按回车键。

  4. 你走了之后好吗? (y / N) 写 Y,你回车。

  5. 你把Y放在一切,接受一切

  6. 接受后写最后一个flutter doctor,等待更新check in green.

  7. 在你关闭 flutter doctor 并输入你的 pubspec.yaml 之后,添加最新版本的 firebase_auth: ^ 0.16.1 和 运行 它。

希望对大家有帮助