亲爱的Flutter社区,
我正在努力完成一项看似简单的任务。我想向firebase
我的应用添加身份验证。它起作用了,iOS
但是当我尝试实现它时android
,我系统地得到了错误:
在以调试方式为x86构建的Android SDK上启动lib / main.dart ...初始化gradle ...解决依赖关系...运行'gradlew assembleDebug'...不建议在项目':app'中配置'compile'。请改用“实现”。不建议使用registerResGeneratingTask,不建议使用registerGeneratedFolders(FileCollection),不建议使用registerResGeneratingTask,请不要使用registerGeneratedFolders(FileCollection),不建议使用RegisterResGeneratingTask,请使用registerGeneratedFolders(FileCollection)在项目':google_sign_in'中配置'compile'。请改用“实现”。
失败:构建失败,发生异常。
出了什么问题:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。
java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。
在https://help.gradle.org上获得更多帮助
在34秒内失败,并完成了以下错误:Gradle构建失败:1
我通过在https://codelabs.developers.google.com/codelabs/flutter-firebase/#4'flutter create'
之后添加Firebase
功能来重现该错误codelab
这是对 pubspec.yaml
dependencies:
flutter:
sdk: flutter
google_sign_in: 0.3.1 # ONLY MODIFICATION
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.0
Run Code Online (Sandbox Code Playgroud)
一般build.gradle
:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath …
Run Code Online (Sandbox Code Playgroud) 这涉及firebase-auth
插件flutter
.我在两台mac计算机上运行相同的代码.我刚刚对后者进行了全新安装,并在上面遇到了一个构建错误FirebaseAuthPlugin.m
:不兼容的块指针
/Users/sergebesnard/Development/flutter/.pub-cache/hosted/pub.dartlang.org/
firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:69:53:
Incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
Run Code Online (Sandbox Code Playgroud)
在我的笔记本电脑上,代码构建顺利,唯一的区别是测试版,这0.3.1
是安装Android工具链.
在iMac上(失败):
flutter doctor -v
[?] Flutter (Channel beta, v0.3.2, on Mac OS X 10.13.4 17E202, locale fr-BE)
• Flutter version 0.3.2 at /Users/sergebesnard/Development/flutter
• Framework revision 44b7e7d3f4 (3 weeks ago), 2018-04-20 01:02:44 -0700
• Engine revision 09d05a3891
• Dart version 2.0.0-dev.48.0.flutter-fe606f890b
[?] …
Run Code Online (Sandbox Code Playgroud) firebase firebase-authentication flutter flutter-dependencies
在更新到最新版本的cloud_firestore
插件(参见pubspec.yaml
下文)之后,应用程序将不再存档在最新的Xcode中,尽管它在模拟器上运行.
跑flutter build ios
- >好的
使用Xcode项目中的指定开发团队自动为iOS设备部署签名:xxxxxx
运行pod安装... 10,8s
运行Xcode清理... 1,2s
启动Xcode构建...
├─建筑飞镖代码...23,5s├─散布颤振资源......2,1s└─编译,链接和签名... 83,3s Xcode构建完成.
在Xcode中,Archive
最终失败了:
While building module 'ProtoRPC' imported from /Users/sergebesnard/Development/Noteworthy/RoByN/app/ios/Pods/FirebaseFirestore/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h:21:
While building module 'GRPCClient' imported from /Users/sergebesnard/Library/Developer/Xcode/DerivedData/Runner-hizooagynttegaeqkhreoqwhrxzc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/gRPC-ProtoRPC/ProtoRPC.framework/Headers/ProtoRPC.h:20:
While building module 'RxLibrary' imported from /Users/sergebesnard/Development/Noteworthy/RoByN/app/ios/Pods/gRPC/src/objective-c/GRPCClient/GRPCCall.h:36:
In file included from <module-includes>:1:
/Users/sergebesnard/Development/Noteworthy/RoByN/app/ios/Pods/Target Support Files/gRPC-RxLibrary/gRPC-RxLibrary-umbrella.h:23:9: error: include of non-modular header inside framework module 'RxLibrary': '/Users/sergebesnard/Library/Developer/Xcode/DerivedData/Runner-hizooagynttegaeqkhreoqwhrxzc/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/gRPC-RxLibrary/RxLibrary.framework/Headers/transformations/GRXMappingWriter.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import "transformations/GRXMappingWriter.h"
^
1 error generated.
While building module 'ProtoRPC' imported from /Users/sergebesnard/Development/Noteworthy/RoByN/app/ios/Pods/FirebaseFirestore/Firestore/Protos/objc/google/firestore/v1beta1/Firestore.pbrpc.h:21:
While building …
Run Code Online (Sandbox Code Playgroud) dart firebase google-cloud-datastore flutter flutter-dependencies