Scala的TaskExecutionException jp.leafytree.gradle.AndroidScalaPlugin $ _addAndroidScalaCompileTask_closure16.doCall

时间:2018-07-17 12:35:51

标签: android scala android-studio

我正在尝试在Android Studio 3.1中设置Scala。 Scala在AS 2.3.3中运行良好,但在3.1中出现了很多构建错误。在运行应用程序时,出现运行任务错误。我以为是因为AS 3.1不支持scala,但我创建了一个演示项目并安装了scala插件,其设置几乎与下面的设置相同,并且可以正常工作。

// LogCat error

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileBizDebugJavaWithJavac'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileBizDebugScala'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:384)
	at org.gradle.api.internal.TaskInternal$execute.call(Unknown Source)
	at jp.leafytree.gradle.AndroidScalaPlugin$_addAndroidScalaCompileTask_closure16.doCall(AndroidScalaPlugin.groovy:271)
	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:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
	at groovy.lang.Closure.call(Closure.java:414)
	at groovy.lang.Closure.call(Closure.java:430)
	at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:718)
	at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:691)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	... 32 more
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler$Compiler.execute(ZincScalaCompiler.java:83)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:52)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:38)
	at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerRunnable.run(AbstractDaemonCompiler.java:87)
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:36)
	at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:46)
	at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:30)
	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:498)
	at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:100)
	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:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:146)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
	... 6 more
Caused by: Compilation failed
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:105)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
	at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:97)
	at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:97)
	at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:97)
	at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:162)
	at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:96)
	at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:139)
	at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
	at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:39)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38)
	at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:66)
	at sbt.inc.Incremental$.compile(Incremental.scala:38)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
	at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:153)
	at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
	at com.typesafe.zinc.Compiler.compile(Compiler.scala:201)
	at com.typesafe.zinc.Compiler.compile(Compiler.scala:183)
	at com.typesafe.zinc.Compiler.compile(Compiler.scala:174)
	at com.typesafe.zinc.Compiler.compile(Compiler.scala:165)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler$Compiler.execute(ZincScalaCompiler.java:81)
	... 26 more
// Project Level build.gradle
buildscript {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
        //maven { url 'https://jcenter.binary.com' }
        //maven { url 'https://repo1.mavan.org/maven2' }
        maven { url 'https://maven.fabric.io/public' }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        //classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.4"
        classpath 'com.github.xingda920813:gradle-android-scala-plugin:android-gradle-2.3.0'
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'io.fabric.tools:gradle:1.+'
    }
    System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
}

allprojects {
    repositories {
        jcenter()
        /*maven { url 'https://jitpack.io' }
        maven {
            url "https://maven.google.com"
        }*/
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
// App Level build.gradle

apply plugin: "com.android.application"

android {
    aaptOptions {
        cruncherEnabled = false
    }
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    def versionPropsFile = file('version.properties')
    def versionBuild
    flavorDimensions "default"
    /*Setting default value for versionBuild which is the last incremented value stored in the file */
    if (versionPropsFile.canRead()) {
        def Properties versionProps = new Properties()
        versionProps.load(new FileInputStream(versionPropsFile))
        versionBuild = versionProps['VERSION_BUILD'].toInteger()
    } else {

    }
    /*Wrapping inside a method avoids auto incrementing on every gradle task run. Now it runs only when we build apk*/
    ext.autoIncrementBuildNumber = {

        if (versionPropsFile.canRead()) {
            def Properties versionProps = new Properties()
            versionProps.load(new FileInputStream(versionPropsFile))
            versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1
            versionProps['VERSION_BUILD'] = versionBuild.toString()
            versionProps.store(versionPropsFile.newWriter(), null)
        } else {
//            throw new GradleException("Could not read version.properties!")
            throw new FileNotFoundException("Could not read version.properties!")
        }
    }
    defaultConfig {
        //multiDexEnabled true
        applicationId "com.example.myapp"
        minSdkVersion 17
        targetSdkVersion 27
        versionCode 14
        buildConfigField "boolean", "ISCSBUILD", "false"
        buildConfigField "boolean", "ISBIZBUILD", "false"
        buildConfigField "boolean", "ISSALEBUILD", "false"
        buildConfigField "boolean", "ISDOCBUILD", "false"

        vectorDrawables.useSupportLibrary = true
        //Sam: 28 Feb 2018: //Added to support vector images
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        debug {
            debuggable true
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            
        }
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            
        }
        staging {
            initWith debug
            debuggable false
            
        }
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    
    applicationVariants.all { variant ->
        variant.outputs.all { output ->
            
            def apkName = output.outputFileName
            if(apkName!=null && apkName.equals("app-a1-debug.apk")){
                output.outputFileName = new File("./../../../../../build/", "a1App.apk")
            }
        }
    }
    splits {
        abi {
            enable true
            reset()
            include 'mdpi', 'hdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi'
            universalApk false
        }
    }
    packagingOptions {
        exclude '.readme'
        exclude 'AndroidManifest.xml'
        exclude 'lib/arm64-v8a/libcardioDecider.so'
        exclude 'lib/arm64-v8a/libcardioRecognizer.so'
        exclude 'lib/arm64-v8a/libcardioRecognizer_tegra2.so'
        exclude 'lib/arm64-v8a/libopencv_core.so'
        exclude 'lib/arm64-v8a/libopencv_imgproc.so'
        exclude 'lib/armeabi/libcardioDecider.so'
        exclude 'lib/armeabi-v7a/libcardioDecider.so'
        exclude 'lib/armeabi-v7a/libcardioRecognizer.so'
        exclude 'lib/armeabi-v7a/libcardioRecognizer_tegra2.so'
        exclude 'lib/armeabi-v7a/libopencv_core.so'
        exclude 'lib/armeabi-v7a/libopencv_imgproc.so'
        exclude 'lib/mips/libcardioDecider.so'
        exclude 'lib/x86/libcardioDecider.so'
        exclude 'lib/x86/libcardioRecognizer.so'
        exclude 'lib/x86/libcardioRecognizer_tegra2.so'
        exclude 'lib/x86/libopencv_core.so'
        exclude 'lib/x86/libopencv_imgproc.so'
        exclude 'lib/x86_64/libcardioDecider.so'
        exclude 'lib/x86_64/libcardioRecognizer.so'
        exclude 'lib/x86_64/libcardioRecognizer_tegra2.so'
        exclude 'lib/x86_64/libopencv_core.so'
        exclude 'lib/x86_64/libopencv_imgproc.so'
    }
}

dependencies {

    //implementation fileTree(include: ['*.jar'], dir: 'libs')
    api fileTree(include: ['*.jar'], dir: 'libs')

    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'

    //compile 'com.google.android.gms:play-services-gcm:9.0.2' //Sam: 9 May 2018: not required for FCM
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    //Sam: 9 May 2018: required for FCM
    implementation 'com.google.firebase:firebase-core:11.0.4'
    //Sam: 9 May 2018: required for FCM
    implementation 'com.google.android.gms:play-services-location:11.0.4'
    implementation 'com.google.android.gms:play-services-maps:11.0.4'
    implementation 'com.google.android.gms:play-services-analytics:11.0.4'

    implementation 'com.android.support:multidex:1.0.1'

    implementation 'org.scala-lang:scala-library-all:2.11.7'
    implementation 'io.spray:spray-json_2.12:1.3.4'
    //implementation 'org.scala-lang.modules:scala-parser-combinators_2.12:1.1.1'

    implementation('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
        transitive = true;
    }
    implementation 'io.github.rockerhieu:emojicon:1.4.2'

    implementation 'com.neovisionaries:nv-websocket-client:1.30'



    implementation 'com.squareup:android-times-square:1.6.5@aar'
    implementation 'com.github.clans:fab:1.6.4'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.paypal.sdk:paypal-android-sdk:2.15.1'

    implementation 'io.github.rockerhieu:emojicon:1.4.2'
    implementation 'net.simonvt.menudrawer:menudrawer:3.0.6'
    implementation 'net.danlew:android.joda:2.9.9'

    //Sam: 17 July 2018: Library Issue
    //implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    implementation files('libs/MPAndroidChart-v3.0.2.jar')
    /*implementation('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
        transitive = true;
        //Sweety 4Sept2016
        implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
        implementation 'com.google.zxing:core:3.2.0'
        implementation 'me.dm7.barcodescanner:zxing:1.9.8'
    }*/
    //implementation 'com.github.SumiMakito:AwesomeQRCode:1.0.6'

    implementation 'com.github.bumptech.glide:glide:3.7.0'

    implementation 'com.prolificinteractive:material-calendarview:1.4.3'


    implementation 'com.google.zxing:core:3.2.0'
    implementation 'com.android.volley:volley:1.0.0'
    //Sam: 16 Feb 2018: Added a Helper class in main/common
    implementation 'com.squareup.okhttp3:okhttp:3.9.1'
    //Sam: 16 March 2018
    implementation 'com.nbsp:library:1.8'
    //Sam: 12 April 2018: For file picking from internal storage
    implementation 'com.koushikdutta.ion:ion:2.1.8'

   

}

/*repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}*/


apply plugin: "jp.leafytree.android-scala"
apply plugin: 'com.google.gms.google-services'
// Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven {
        url "http://dl.bintray.com/lukaville/maven"
    }
}

tasks.withType(ScalaCompile) {
    // scalaCompileOptions.useAnt = false
    // scalaCompileOptions.useCompileDaemon = true
    scalaCompileOptions.deprecation = false
    scalaCompileOptions.additionalParameters = ["-feature"]
}
tasks.withType(JavaCompile) {
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

0 个答案:

没有答案