所以今天早上我开始更新到我的项目库的最新版本.
我正在尝试将GCM更新到最新版本9.2.0,但是我收到此错误:
错误:任务':app:processDebugGoogleServices'的执行失败.请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或将com.google.android.gms的版本更新为9.0.0.
这就是我的代码:
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
Run Code Online (Sandbox Code Playgroud)
然后:
dependencies {
...
compile "com.google.android.gms:play-services-gcm:9.2.0"
...
}
Run Code Online (Sandbox Code Playgroud)
任何人有同样的问题/修复同样的问题?
谢谢.
编辑
显然你必须在app/build.gradle文件的底部应用你的GSM插件.否则,版本9.2.0将导致项目冲突.
作为参考,这就是我的app/build.gradle文件现在的样子:
apply plugin: "com.android.application"
apply plugin: "com.neenbedankt.android-apt"
android {
...
}
dependencies {
...
// Google Cloud Messaging
compile "com.google.android.gms:play-services-gcm:9.2.0"
...
}
apply plugin: "com.google.gms.google-services"
Run Code Online (Sandbox Code Playgroud) 这就是我想要做的,它是 iOS 上非常常见的 Widget。这是我的代码:
return Scaffold(
backgroundColor: Colors.white,
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
automaticallyImplyLeading: false,
pinned: true,
titleSpacing: 0,
backgroundColor: Colors.white,
elevation: 1.0,
title: Container(
width: double.infinity,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
CupertinoButton(
padding: EdgeInsets.all(0),
onPressed: () {},
child: AutoSizeText(
'Ordenar',
style: TextStyle(
color: Color(0xff16161F),
fontFamily: 'Brutal',
fontSize: 17.0,
),
),
),
AutoSizeText(
'Equipos 14',
style: TextStyle(
color: Color(0xff16161F),
fontFamily: 'Archia',
fontSize: 22.0,
),
),
CupertinoButton(
padding: EdgeInsets.all(0),
onPressed: () {},
child: AutoSizeText(
'Editar', …Run Code Online (Sandbox Code Playgroud) 因此,我遵循了bloc登录教程,尽管我设法完成了该教程,但对于Flutter&Dart还是很陌生。
代码的一部分,根据状态的不同,代码将返回不同的小部件,而不是新的Scaffold。由于未使用路由,因此页面之间的过渡看起来比较混乱且笨拙。
return BlocProvider<AuthenticationBloc>(
bloc: authenticationBloc,
child: MaterialApp(
debugShowCheckedModeBanner: false,
home: BlocBuilder<AuthenticationEvent, AuthenticationState>(
bloc: authenticationBloc,
builder: (BuildContext context, AuthenticationState state) {
if (state is AuthenticationUninitialized) {
return SplashPage();
}
if (state is AuthenticationAuthenticated) {
return HomePage();
}
if (state is AuthenticationUnauthenticated) {
return LoginPage(userRepository: userRepository);
}
if (state is AuthenticationLoading) {
return LoadingIndicator();
}
},
),
),
);
Run Code Online (Sandbox Code Playgroud)
我尝试添加添加返回的Navigation.push,如下所示:
if (state is AuthenticationUninitialized) {
Navigation.push(
return SplashPage();
),
}
Run Code Online (Sandbox Code Playgroud)
但是,虽然从语法上看并没有错,但它会使应用程序崩溃。有谁知道在维护BLoC示例的同时实现此目的的方法?谢谢。