AndroidProguardScala icon indicating copy to clipboard operation
AndroidProguardScala copied to clipboard

A.P.S. won't analyze code from required projects (project dependencies)

Open magicgoose opened this issue 12 years ago • 11 comments

If an Android project uses another Scala project or library, there may be parts of Scala library that are used by them but not by Android project itself directly, and A.P.S. removes these parts, so the final .apk is broken, maybe there is a quick&dirty way to live with it?

magicgoose avatar Jan 30 '13 16:01 magicgoose

You've got two choices in preferences for those: input or library. Does that not solve it for you? (If you mark them as input, code from there will end up in the minified jar. If you mark them as library, no code from them will be included in the minified jar, but proguard will walk through them to figure out what they use. Take a look at the proguard conf file to see exactly what's happening.)

banshee avatar Jan 30 '13 17:01 banshee

Is there a way to reference a project, not packaged into jar? Its code is updated frequently, so it will be not very cool to make a jar of it every time. I'm sorry for mentioning libraries, they are OK now, as I understand. Just didn't see that configuration page until posting.

magicgoose avatar Jan 30 '13 19:01 magicgoose

Just a regular eclipse project? Right now the only way to include those is to use them as an input project. The problem with that is that you're going to get a lot of cache misses; any change in the referenced project is going to cause a proguard run.

It wouldn't be too hard to add this feature though - let me think about it.

banshee avatar Feb 01 '13 06:02 banshee

The workaround right not would be to put them into an Android library project; those should work well.

banshee avatar Feb 01 '13 06:02 banshee

Thanks!

magicgoose avatar Feb 01 '13 08:02 magicgoose

@banshee Yes, just a regular eclipse project with scala code (that obviously uses some parts of scala library). But it can be treated as if its source files were in our main android project, isn't it? Input sources must be analysed anyway, because we must know what parts of Scala library they use. As I understand, the plugin does almost exactly this.

magicgoose avatar Feb 01 '13 08:02 magicgoose

The code is already in the analysis system, you're right. The thing I'd need to add would be to tell Android that the code needs to be included in the Android build. I've been hoping the Android build system would add that feature so I wouldn't have to. If it were handled by Android, you'd just mark it as a library jar.

banshee avatar Feb 01 '13 17:02 banshee

I'd love to have that, too. It would be useful for libgdx-based development, for example.

jmhofer avatar Jan 05 '14 15:01 jmhofer

@jmhofer IntelliJ IDEA can handle this.

magicgoose avatar Jan 07 '14 10:01 magicgoose

@magicgoose Thanks! - I haven't really tried Android development with IDEA yet, but will most probably do so on my next project.

jmhofer avatar Jan 07 '14 14:01 jmhofer

@jmhofer take a look at https://github.com/magicgoose/android-scala-intellij-no-sbt-plugin

magicgoose avatar Jan 09 '14 07:01 magicgoose