微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

应用程序不在发布模式下构建

如何解决应用程序不在发布模式下构建

我尝试为我的应用构建一个Realese签名的apk,但是有两个错误。首先是被gradle抛出,就像丢失了一些文件,其次来自firebase消息传递插件。我已经在build.gradle中将CompileSdkVersion设置为28!在使用Flutter build apk --split-per-abi命令进行构建之前,我每次都会运行得井井有条。顺便说一句,应用程序包的构建没有问题。这是终端的输出

Running "Flutter pub get" in lock_ui...                             1,1s
Note: C:\Flutter\Flutter\.pub-cache\hosted\pub.dartlang.org\android_intent-0.3.7+4\android\src\main\java\io\Flutter\plugins\androidintent\MethodCallHand
lerImpl.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Flutter\Flutter\.pub-cache\hosted\pub.dartlang.org\Flutter_blue-0.7.2\android\src\main\java\com\pauldemarco\Flutter_blue\FlutterBluePlugin.java
 uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\WheelKeep\lock_ui\build\Flutter_blue\generated\source\proto\release\javalite\com\pauldemarco\Flutter_blue\Protos.java uses unchecked or unsafe
operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Flutter\Flutter\.pub-cache\hosted\pub.dartlang.org\Flutter_secure_storage-3.3.4\android\src\main\java\com\it_nomads\Fluttersecurestorage\cipher
s\RSACipher18Implementation.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build Failed with an exception.

* What went wrong:
Execution Failed for task ':shared_preferences:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > 1 exception was raised by workers:
     com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking Failed
     C:\Users\andri\.gradle\caches\transforms-2\files-2.1\3ae8acf77913112ba07cff775c9265b3\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: r
esource android:attr/fontvariationSettings not found.

     C:\Users\andri\.gradle\caches\transforms-2\files-2.1\3ae8acf77913112ba07cff775c9265b3\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: r
esource android:attr/ttcIndex not found.



* 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 42s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                     103,6s
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 android_intent...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                    2,4s
√ Built build\app\outputs\repo.
Building plugin firebase_core...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done                   74,0s


FAILURE: Build completed with 2 failures.

1: Task Failed with an exception.
-----------
* What went wrong:
Execution Failed for task ':javaPreCompileRelease'.
> Could not resolve all files for configuration ':releaseCompileClasspath'.
   > Could not find com.google.firebase:firebase-bom:25.3.1.
     required by:
         project :
   > Could not find com.google.firebase:firebase-core:.
     required by:
         project :
   > Could not find androidx.annotation:annotation:1.1.0.
     required by:
         project :

* 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.
==============================================================================

2: Task Failed with an exception.
-----------
* What went wrong:
Execution Failed for task ':generateReleaseRFile'.
> Could not resolve all files for configuration ':releaseRuntimeClasspath'.
   > Could not find com.google.firebase:firebase-bom:25.3.1.
     Searched in the following locations:
       - https://storage.googleapis.com/download.Flutter.io/com/google/firebase/firebase-bom/25.3.1/firebase-bom-25.3.1.pom
       - https://storage.googleapis.com/download.Flutter.io/com/google/firebase/firebase-bom/25.3.1/firebase-bom-25.3.1.jar
     required by:
         project :
   > Could not find com.google.firebase:firebase-core:.
     required by:
         project :
   > Could not find androidx.annotation:annotation:1.1.0.
     Searched in the following locations:
       - https://storage.googleapis.com/download.Flutter.io/androidx/annotation/annotation/1.1.0/annotation-1.1.0.pom
       - https://storage.googleapis.com/download.Flutter.io/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar
     required by:
         project :

* 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 13s


The plugin firebase_core Could not be built due to the issue above.

解决方法

尝试使用旧版Firebase库。我遇到了同样的问题,并且在降级Firebase版本后消失了。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。