GluonMobile:mergeAndroidAssets任务失败(缺少@Inject)

时间:2019-03-14 16:09:47

标签: java android gluon-mobile javafxports

我正在与GluonMobile进行一个项目。最近,我在android-module中添加了一些android-assets。之后,我无法运行android构建(apkDebug,...),因为发生以下错误:

[...]
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':[project-name]:mergeAndroidAssets'.
> There were multiple failures while executing work items
   > A failure occurred while executing com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction
      > Could not create an instance of type com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction.
         > The constructor for class com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction should be annotated with @Inject.
   > A failure occurred while executing com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction
      > Could not create an instance of type com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction.
         > The constructor for class com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction should be annotated with @Inject.
   > A failure occurred while executing com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction
      > Could not create an instance of type com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction.
         > The constructor for class com.android.ide.common.res2.MergedAssetWriter$AssetWorkAction should be annotated with @Inject.

这是我的build.gradle中的一个片段:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        google()
        maven {
            url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
        }
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:+'

        classpath 'com.github.jengelman.gradle.plugins:shadow:+'
    }
}

apply plugin: 'org.javafxports.jfxmobile'

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'idea'

repositories {
    mavenCentral()
    jcenter()
    google()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
    maven {
        url uri('libs')
    }
}

mainClassName = '[...].main.Main'
version = '2.0_Alpha'

dependencies {
    compile 'com.gluonhq:charm:+'
    compile 'com.gluonhq:glisten-afterburner:+'

    [...]
}

jfxmobile {
    downConfig {
        version = '+'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        //noinspection GroovyAssignabilityCheck
        plugins 'browser', 'connectivity', 'display', 'lifecycle', 'statusbar', 'storage'
    }
    android {
        manifest = 'src/android/AndroidManifest.xml'
        compileSdkVersion = 28
        targetSdkVersion = 22
        minSdkVersion = 16
    }
}
[...]

(我知道,您不应该使用'+'版本,但是对我来说很正常。)

有人知道如何解决吗?

谢谢

1 个答案:

答案 0 :(得分:0)

感谢JoséPereda,我找到了一个解决方案:我将jfxmobile-plugin降级到1.3.16版。