我只是编写com.firebaseui:firebase-ui:0.4.3并且我收到错误:
错误:任务':app:compileDebugJavaWithJavac'执行失败。 >编译失败;有关详细信息,请参阅编译器错误输出。
没有任何额外的代码。只是编译,我得到了错误。红线显示com.android.support.appcompat-v7:25.3.1(支持库必须使用完全相同的版本)。这是什么意思?
<?apply plugin: 'com.android.application' android
{ compileSdkVersion 25 buildToolsVersion '25.0.2' defaultConfig { applicationId "com.example.mayur.mahadev"
minSdkVersion 22 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
packagingOptions { exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE' exclude
'META-INF/LICENSE' exclude
'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } }
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' })compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.firebaseui:firebase-ui:0.4.3'
compile 'com.google.firebase:firebase-database:10.0.1' testCompile 'junit:junit:4.12' }
apply plugin: 'com.google.gms.google-services'?>
答案 0 :(得分:0)
您必须为您的应用添加multidex支持,因为您正在编译超过64k的方法,有关详细信息,请参阅this official documentation。
您必须在应用级别的gradle中添加以下两行:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
将此行添加到您的清单中:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
并将这些代码snipet添加到您的所有活动中:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}