You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I'm not a real Android developer, I only recently discovered the use of d8 for me, and fortunately the plugin supports it. However, I'm not really sure whether I'm doing it all right, but I'm really confused about how the plugin manages the invocation of d8. From what I see in the source code, the plugin invokes d8 by starting the JVM directly passing the -jar parameter referencing the d8.jar file from the build tools lib directory. I don't really know why it was designed like that, but I also see that the original JAR file in any build tools version I installed lacks the manifest file, therefore the JVM started by the plugin crashes on start with the following output:
[INFO] Convert classes to Dex : PROJECT_PATH/target
[INFO] no main manifest attribute, in ANDROID_SDK_PATH/build-tools/VERSION/lib/d8.jar
Build tools provide the d8 tool as a runner script, so switching from java -jar ANDROID_SDK_PATH/build-tools/VERSION/lib/d8.jar to ANDROID_SDK_PATH/build-tools/VERSION/d8 would do the job. While trying to figure out the core issue, I also made some minor changes to the plugin by adding a temporary d8UseRunner configuration option that switches the plugin to the "runner"/"launcher" mode that starts d8 with its dedicated script. The changes are far from being perfect, of course, but they seem to build a proper APK file for me.
I have a few questions:
Is my Android SDK merely broken in any way? (I tested it on two machines with Windows and Linux Mint, but neither worked properly).
Did something change in the Android SDK and android-maven-plugin+d8 worked together nicely earlier?
I have not tested the plugin for a while or cut any releases. I know it used to work with d8 but the Android SDK has always been changing and breaking things so I would not be surprised if it does not currently work. Unfortunately I also do not have the time to look into this.
I know it used to work with d8 but the Android SDK has always been changing and breaking things so I would not be surprised if it does not currently work.
I used to believe that the Android SDK is constantly stable and does not change things like that, but as far as I can see they changed the behavior and the Main-Class entry was removed from the manifest in build-tools;29.0.1.
I would appreciate further code/design review in my changes.
We would generally invoke the Java class directly rather than invoke via a shell script as this keeps it platform agnostic.
I have submitted #796 to do just that.
Just wondering: would it be worth having a platform-independent shell-script runner? Sometimes shell scripts may have more than just starting an external JAR.
Possibly and I take your point.
Personally I try and avoid shell scripts because they just add another layer of complexity. Best to just invoke the app directly.
Activity
mosabua commentedon Aug 25, 2020
I have not tested the plugin for a while or cut any releases. I know it used to work with d8 but the Android SDK has always been changing and breaking things so I would not be surprised if it does not currently work. Unfortunately I also do not have the time to look into this.
lyubomyr-shaydariv commentedon Aug 25, 2020
@mosabua
I used to believe that the Android SDK is constantly stable and does not change things like that, but as far as I can see they changed the behavior and the
Main-Classentry was removed from the manifest inbuild-tools;29.0.1.I would appreciate further code/design review in my changes.
william-ferguson-au commentedon Nov 14, 2020
We would generally invoke the Java class directly rather than invoke via a shell script as this keeps it platform agnostic.
I have submitted #796 to do just that.
lyubomyr-shaydariv commentedon Nov 14, 2020
@william-ferguson-au thank you!
Just wondering: would it be worth having a platform-independent shell-script runner? Sometimes shell scripts may have more than just starting an external JAR.
william-ferguson-au commentedon Nov 14, 2020
Possibly and I take your point.
Personally I try and avoid shell scripts because they just add another layer of complexity. Best to just invoke the app directly.
lyubomyr-shaydariv commentedon Nov 14, 2020
@william-ferguson-au got it, I hope they won't change it like that in the future. Thanks!
Closing this one in favor of #796.