得到错误“执行失败的任务‘:应用程序:compileDebugJavaWithJavac’”
问题描述:
我只是写编译com.firebaseui:火力的用户界面:0.4.3,我得到了错误:得到错误“执行失败的任务‘:应用程序:compileDebugJavaWithJavac’”
Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details.
无需任何额外的代码。只是编译和和我得到错误。红线显示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'?>
答
你必须在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>
并添加这些一小段代码片段到所有activites:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
+0
不工作编译显示红线编译'com.android.support:multidex:1.0.1' –
嗨。发布完整的gradle文件。 –
嗨a b。请*编辑*帖子并粘贴gradle文件,以便社区能够正确阅读。 :) –
哦好吧好吧谢谢 –