0

I'm trying to use the gradle plugin gluonfx-gradle-plugin to package my application for Android.

With a template project provided in Intellij, I'm getting the following error when launching the nativePackage task :

[lun. déc. 19 21:22:05 CET 2022][PRÉCIS] [SUB] Execution failed for task ':app:processDebugResources'. [lun. déc. 19 21:22:05 CET 2022][PRÉCIS] [SUB] > A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction [lun. déc. 19 21:22:05 CET 2022][PRÉCIS] [SUB] > Android resource linking failed [lun. déc. 19 21:22:05 CET 2022][PRÉCIS] [SUB] /home/***/TestGluonMobile/Gluon-SingleViewProject/build/gluonfx/aarch64-android/gvm/android_project/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml:2: error: attribute 'package' in tag is not a valid Android package name: '.GluonSingleViewProject'.

The package name is malformed. I haven't seen where the package is set.

My configuration is the following :

  • Gradle 7.2
  • Java 17.0.4
  • gluonfx-gradle-plugin 1.0.16
  • JavaFX 17

Thank you for advance

  • You can try to copy and [modify](https://docs.gluonhq.com/#platforms_android_distribution_manifest) the AndroidManifest to remove `package`, but you also need to add a `namespace` to the build gradle file (like in [here](https://github.com/gluonhq/attach/blob/master/gradle/android_project/library/build.gradle#L5). Then you need to package manually (see for reference "Modifying the Android project" from this [post](https://stackoverflow.com/a/68685263/3956070)). – José Pereda Dec 20 '22 at 13:29
  • Thank you. The procedure seems to be complex, I will try it this week or next week. I'm building a very basic project created with the gluon plugin for Intellij, there isn't any way to have the nativePackage task working for the gluonfx-gradle-plugin in a standard way without having to "patch" the build process ? I don't understand the reason the package is malformed. – kevin guirado Dec 20 '22 at 22:07
  • It works by default, without patches, indeed. But there is this possibly related [issue](https://github.com/gluonhq/substrate/issues/1188), and that's why I suggested the patch. However, it might not be the case, since it doesn't mention "deprecated", and gives an error: your package name `.GluonSingleViewProject` seems wrong (why the `"."`??). Try to change it to something like `com.sample.GluonSingleViewProject` in your build.gradle and build/package again? – José Pereda Dec 20 '22 at 22:17
  • Can you post your build.gradle and `Gluon-SingleViewProject/build/gluonfx/aarch64-android/gvm/android_project/app/build/intermediates/packaged_manifests/debug/AndroidManifest.xml`? – José Pereda Dec 20 '22 at 22:18
  • Hi José, I have added the project in GitHub : [https://github.com/guirak/testGluonFxGradlePlugin](https://github.com/guirak/testGluonFxGradlePlugin). I have placed a copy of the generated AndroidManifest.xml in the root directory. Thank you. – kevin guirado Dec 21 '22 at 09:39
  • Thanks. It is weird. Your IDE project name was `Gluon-SingleViewProject`, but somehow that gets into `package='.GluonSingleViewProject'`... But since your online project name now is `testGluonFxGradlePlugin`, maybe you can remove your IDE files (`.idea/`, `*.iml`), reload the project and build/package again? – José Pereda Dec 21 '22 at 09:52
  • I have just re-cloned my project from github, removing the .iml file. The idea folder is not stored in github so I started with a new one when loading the project in Intellij. I have launched the gluonfx tasks again. It is still falling when launching the nativePackage task. I have updated the changes in GitHub with the new generated AndroidManifest. The package name changed to the new project folder name ".testGluonFxGradlePlugin". Maybe this mean it's necessary to use the Gluonfx gradle plugin into a gradle sub project only ? – kevin guirado Dec 21 '22 at 16:21
  • Right! The problem come from that. Moving the source code and build.gradle in a sub project, it's working well and I congratulate to launch the app in my phone. So the problem come from having a single project build. I update my github repository with the changes done – kevin guirado Dec 21 '22 at 16:36
  • 1
    Great! It should work out of the box in a gradle project (not a sub project). See related [code](https://github.com/gluonhq/gluonfx-gradle-plugin/blob/master/src/main/java/com/gluonhq/gradle/tasks/ConfigBuild.java#L135). If `project.group` is not set (which it is the case for the default template project), that will fail. Alternatively, instead of using a sub-project, `appIdentifier` can be set. – José Pereda Dec 21 '22 at 17:20
  • I've filed an issue: https://github.com/gluonhq/gluonfx-gradle-plugin/issues/169 – José Pereda Dec 21 '22 at 17:24

0 Answers0