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
I added that file only for those who wished to use Java 9 modules. Using modules is somewhat optional (you can choose to put everything in the default module).
So you can just delete that source file module-info.java, and you can delete the compiled file module-info.class, it doesn't need to be there when not using modules.
Perhaps I will add another jar file that does not have module-info inside. In reality the file should be ignored when not using modules but I guess your android environment is not ignoring it. You can just use any zip-file tool (winzip, gzip, winrar, zip, etc) to remove the module-info class file from your jar file (a jar file is actually a zip file).
I see. Thanks for the info.
I'm using gradle for dependencies and it pulls everything from mavenCentral
so I think there is no permenant way for me to remove that file without
having a local repo.
So if it's not too much of hassle I would be grateful if you could have
another jar like you mentioned.
BTW I'm using react native and its build environment. It's likely that
people using react native will get the exact same error.
Thanks
On Tue, 8 Jan 2019, 22:44 Sean C Foley ***@***.*** wrote:
Perhaps I will add another jar file that does not have module-info inside.
In reality the file should be ignored when not using modules but I guess
your android environment is not ignoring it. You can just use any zip-file
tool (winzip, gzip, winrar, zip, etc) to remove the module-info class file
from your jar file (a jar file is actually a zip file).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANq8Jd3voB35SrNJXaSTXxuBz2NQh-uks5vBPUGgaJpZM4Z2Hji>
.
@tapir Strangely, there appear to be no simple solution from any of Maven, Android Studio, Java, or Gradle, although eventually Android Studio will likely have some kind of fix.
From what I can tell, what others have done:
put separate jar on maven just for android, which seems like a lot of extra overhead just to delete a single small file
dependencies {
// Use jarjar.repackage in place of a dependency notation.
compile jarjar.repackage {
from 'com.github.seancfoley:ipaddress:5.0.1'
classDelete "module-info"
}
}
Not sure if you would need "module-info" or "module-info.class"
Processing module-info.class during desugaring analysis caused failures with the message java.lang.IllegalArgumentException: Type without superclass: module-info. This file is now filtered out during desugaring analysis.
Activity
seancfoley commentedon Jan 8, 2019
The module-info is used only with Java 9 and up for the new "Jigsaw" module feature added with Java 9:
https://www.oracle.com/corporate/features/understanding-java-9-modules.html
I added that file only for those who wished to use Java 9 modules. Using modules is somewhat optional (you can choose to put everything in the default module).
AFAIK Android does not yet support Java 9, but does support most, if not all, of Java 8. Certainly, it sounds like your android version does not support Java 9 modules.
https://stackoverflow.com/questions/47627499/does-android-studio-3-support-java-9-for-android-development-if-so-what-featur
So you can just delete that source file module-info.java, and you can delete the compiled file module-info.class, it doesn't need to be there when not using modules.
seancfoley commentedon Jan 8, 2019
Perhaps I will add another jar file that does not have module-info inside. In reality the file should be ignored when not using modules but I guess your android environment is not ignoring it. You can just use any zip-file tool (winzip, gzip, winrar, zip, etc) to remove the module-info class file from your jar file (a jar file is actually a zip file).
tapir commentedon Jan 8, 2019
seancfoley commentedon Jan 8, 2019
OK, seems you are not the first to encounter this.
Azure/azure-iot-sdk-java#302
Fazecast/jSerialComm#128
Azure/azure-iot-sdk-java#313
JodaOrg/joda-money#94
Leanplum/Leanplum-Android-SDK#251
Not sure if anyone found a nice solution in any of those other issues.
I'll have to give this a little thought.
seancfoley commentedon Jan 9, 2019
@tapir Strangely, there appear to be no simple solution from any of Maven, Android Studio, Java, or Gradle, although eventually Android Studio will likely have some kind of fix.
From what I can tell, what others have done:
put separate jar on maven just for android, which seems like a lot of extra overhead just to delete a single small file
there appears to be a jarjar tool some have used, such as in that fazecast bug above Android studio build failed Fazecast/jSerialComm#128 (comment)
and here https://stackoverflow.com/questions/44913406/exclude-one-class-file-in-gradle-android-studio
This appears to be the tool: https://github.com/shevek/jarjar
Looks like you would need something like this:
Not sure if you would need "module-info" or "module-info.class"
There is a complete example build file here: https://github.com/shevek/jarjar/blob/master/jarjar-gradle/example/build.gradle
Can you try this second option?
tapir commentedon Jan 9, 2019
looks like a good solution to me. thanks
seancfoley commentedon Jan 9, 2019
@tapir Have you tried it? If and when you try it, can you let me know if it works?
tapir commentedon Jan 9, 2019
Sorry it took a while. Most of the time I've spent went to solve how to apply gradle plugins. TL,DR: It works.
I consider this issue solved.
seancfoley commentedon Jan 9, 2019
@tapir Great! Good to know it works. Also, keep in mind Android Studio will almost certainly have its own fix eventually.
seancfoley commentedon Jan 6, 2020
This appears to have been fixed in Android Studio 3.3