is there a way to pass libraries pulled from maven central as injars for proguard? I want them to be obfuscated. Context: remove unused classes with proguard for Android
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I never used Maven and I'm using Gradle, but either build syste, the same thing applies I believe. And I don't think that what you want is possible...
The
-injars
keyword is specific to the ProGuard configuration file, which is a text file read by the build tools.The only way I see is that if you build some kind of script that will that for you. That is, read all Maven dependencies, create the appropriate ProGuard configuration file specifying all the required -injars and pass it to the build process. Not sure how feasible is this with Maven.
It shouldn't be too difficult with Gradle. With Gradle you can easily pass multiple ProGuard configuration files and you could just create a method in the
build.gradle
file to get all the .jar file locations from the dependencies and create a temporary text file that you would then pass into the ProGuard configuration.I would assume the same process would work with Maven, but again, I never used it.
EDIT: I see now the question asked Gradle specifically. My answer is for Ant, but it might give you ideas.
A complete solution involves these steps:
Steps in detail:
1. Custom build.xml
In build.xml, put in "custom", as such:
Before this bit, insert the code below, or put it in a separate file (general-build.xml) and import that into build.xml.
2. Target
Insert the following:
Another way to do it is to copy in jars only temporary (the same technique is used for regular Java project dependencies that are not Android library projects):
But it compiles jars one by one and copies them, so for Maven, where jars are already available, this is a disadvantage.
3. Maven dir
"/some-maven-dir" is a directory where jars are stored.
4. Maven automation
I can't help here, but I put up a suggestion for the first part. Perhaps someone can continue with this.