无法解决Android错误:任务执行失败':app:compileDebugJavaWithJavac'

时间:2016-01-27 19:46:04

标签: java android android-studio gradle android-gradle

仍有以下错误:

 Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
 Compilation failed; see the compiler error output for details.

即使在stackoverflow上尝试解决方案之后,我仍然坚持如何解决这个问题。有人指导我如何解决这个问题吗?

当我同步我的项目时,一切正常,但是当我运行应用程序时它会崩溃。 过去一个月,everthing工作正常,突然崩溃。

根据我在网站上Api 22发现的博客,creativesdkAdobe Creative sdk为目标,可以正常使用此API。

完整的错误消息:

:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
An exception has occurred in the compiler (1.8.0_60). Please file a bug at the Java Bug Database (http://bugreport.java.com/bugreport/) after checking the database for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.ClassFormatError: Illegal UTF8 string in constant pool in class file com/sun/tools/javac/tree/DocTreeMaker
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)  
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.sun.tools.javac.parser.ParserFactory.<init>(ParserFactory.java:73)
at com.sun.tools.javac.parser.ParserFactory.instance(ParserFactory.java:54)
at com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:356)
at com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:88)
at com.sun.tools.javac.main.Main.compile(Main.java:485)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:45)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
at org.gradle.api.internal.tasks.compile.daemon.CompilerDaemonServer.execute(CompilerDaemonServer.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745):app:compileDebugJavaWithJavac FAILED
Error:Execution failed for task ':app:compileDebugJavaWithJavac'
Compilation failed; see the compiler error output for details.

我的build.gradle(app):

apply plugin: 'com.android.application'

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
}
}

allprojects {
apply plugin: 'maven'

tasks.withType(JavaCompile) {
    options.fork = true

    options.incremental = true
}
repositories {
    mavenCentral()
    jcenter()

    maven {
        url "${project.rootDir}/creativesdk-repo/release"  //ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
    }
}
}

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.example.yo.mophoto"
    minSdkVersion 21
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    renderscriptTargetApi 22
    renderscriptSupportModeEnabled true
}
signingConfigs {
    release {
        storeFile file('release.key')
        storePassword '123456'
        keyAlias 'alias'
        keyPassword '123456'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
    main {
        setRoot 'src/main'
    }

    debug {
        setRoot 'src/debug'
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
        minifyEnabled false
    }
}
packagingOptions {
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE.txt'
}
dexOptions {
    jumboMode true
    incremental true
    preDexLibraries false
    javaMaxHeapSize "4g"
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.adobe.creativesdk:image:4.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile files('libs/universal-image-loader-1.9.0.jar')
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
}

1 个答案:

答案 0 :(得分:5)

好像你正在使用java 1.8。和

$img_src

我建议你试试java 1.7。 我不确定,但错误看起来像this无法解析您的文字。

我也建议compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }