0

I'm working on a project with GluonMobile. Recently I added some android-assets to the android-module. After that I was not able to run an android build (apkDebug, ...), because the following error occurred:

[...]
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.

Here is a snipped from my 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
    }
}
[...]

(I know, you should not use '+' versions, but it woks for me.)

Does somebody know how to solve this?

Thanks

Max.-F.
  • 303
  • 4
  • 11
  • 1
    Actually the `'+'` versions can be a real problem. Plugin jfxmobile 1.3.16 is quite different from 2.0.30 (see [this](https://stackoverflow.com/a/53897538/3956070)). The latter requires charm 5.0.0-jdk9, while you will probably be using 5.0.2 ... I'd really recommend setting proper values (based on this [sample](https://github.com/gluonhq/gluon-samples/blob/master/notes-proguard/build.gradle)). – José Pereda Mar 14 '19 at 16:25
  • Can you try setting those version values, test again and update your question (with details on what have you added as "android-assets"). – José Pereda Mar 14 '19 at 16:27

1 Answers1

0

Thanks to José Pereda I found a solution: I downgraded the jfxmobile-plugin to version 1.3.16.

Max.-F.
  • 303
  • 4
  • 11