最近我根据IDE的建议将Android Studio从0.4.2更新到0.5.0,将Android Gradle Plug-In从0.7.2更新到0.9.0.项目运行并安装良好,但是当我按下Build-> Rebuild Project时,它会抛出一个错误,停止重建.消息选项卡中出现以下错误:
Information:See complete output in console
Error:Execution failed for task ':projectName:proguardDebug'.
> java.io.IOException: Please correct the above warnings first.
Run Code Online (Sandbox Code Playgroud)
以下是控制台中描述的问题:
:projectName:proguardDebug
Note: there were 2345 duplicate class definitions.
Warning: com.facebook.Settings: can't find referenced class com.facebook.android.BuildConfig
Warning: com.facebook.Settings: can't find referenced class com.facebook.android.BuildConfig
Warning: com.facebook.internal.Utility: can't find referenced class com.facebook.android.BuildConfig
Warning: com.facebook.internal.Utility: can't find referenced class com.facebook.android.BuildConfig
Warning: there were 4 unresolved references to classes or interfaces.
You may need to add missing library jars or …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的演示者编写一个简单的Robolectric测试,该测试使用Firebase数据库和Firebase Auth.但每次我尝试启动测试时,都会抛出IllegalStateException.
java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
我的测试非常简单
@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class)
public class LoginPresenterTest {
private LoginPresenter presenter;
private LoginMvpView view;
@Before
public void beforeEachTest() {
presenter = new LoginPresenter();
view = new LoginFragment();
}
@Test
public void attachView_shouldAttachViewToThePresenter() {
presenter.attachView(view);
assertSame(presenter.getMvpView(), view);
}
}
Run Code Online (Sandbox Code Playgroud)
在我的演示者构造函数中,我只是获取Firebase实例.
public LoginPresenter() {
this.firebaseAuth = FirebaseAuth.getInstance();
this.database = FirebaseDatabase.getInstance().getReference();
}
Run Code Online (Sandbox Code Playgroud)
有没有办法将Robolectric与Firebase一起使用?
android robolectric firebase firebase-authentication firebase-realtime-database