QuickNick
QuickNick

Reputation: 1931

Android Library Project: Obfuscate and keep resources

I want to compile with Proguard my Android project with some additional Android Library Projects. In fact, most of code and resources lie in these libraries.

I've added line "proguard.config=proguard.cfg" into project.properties of main project, I've configured cfg-file (-libraryjars ..\libs). Then - right click, Android Tools -> Export Signed Application Package. ADT compiled project for release but app crashed at the first launch: as I read from log, it was because of wrong resource pointer.

I've decompiled project and found out very strange thing: if I declare resource in the library, then resource pointer on it becomes 0.

Problem didn't disappear when I add line "proguard.config=proguard.cfg" into project.properties of all of my Android Library Project.

Any solutions?

Edit: look at fragment of proguard.cfg:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !

-printusage unused.txt
-optimizationpasses 2
-printmapping mapping.txt
# -overloadaggressively
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt

-libraryjars ..\libs

Upvotes: 11

Views: 3854

Answers (2)

WarrenFaith
WarrenFaith

Reputation: 57672

How do you include/reference to your Android Library Projects? If I read it correctly, you add them as a jar? If so you really might got some trouble with the resources provided by the library projects.

If I am right, try that:

Use the Project Settings and add your library projects there. Do not use some exported jars for that. The way an Android Library Project works is way different than a normal java library works.

Upvotes: 1

pandre
pandre

Reputation: 6725

Are you sure you have the latest tools? Like Eclipse Indigo, ADT v16.0.1 and proguard 4.7? I also had issues before updating to the latest tools.

Upvotes: 1

Related Questions