user2224350
user2224350

Reputation: 2304

Configuring ProGuard for android-eclipse project with multiple jars

I want to use ProGuard for my android app, but I have some trouble with it. When I build an unsigned apk via android tools (in eclipse) I got following errors:

Warning: com.millennialmedia.android.NVASpeechKit$7: can't find referenced class com.nuance.nmdp.speechkit.Recognizer
[...] //more warnings of the same type as above
You should check if you need to specify additional program jars.
Warning: there were 170 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)

I'm using 5 jar files within my app, which are all located in the libs-folder and are added to the build-path (So they propably appear in 'Referenced Libraries' as well as 'Android Private Libraries' again). Additionally, I put a so-library in libs/armeabi...

My proguard - file look pretty normal, yet:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontpreverify
-dontskipnonpubliclibraryclasses
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** e(...);
}

What should I do to fix this error?

regards

PS: I know that proguard can delete/change some important things (like class-files,..). So, will I notice such 'errors' by exceptions immediately when starting my app or do I have to check every detail and navigate to any part of my app at runtime to make sure that it runs as it should?

EDIT: I'm using following jars:

alljoyn.jar (there's also a path varibale in linked resources to the alljoyn-sdk)

peergroupmanager.jar

android-support-v4.jar

MMSDK.jar

GoogleAdMobAdsSdk-6.4.1.jar

Upvotes: 0

Views: 1026

Answers (1)

scottyab
scottyab

Reputation: 24039

From http://docs.millennialmedia.com/android-SDK/AndroidFAQ.html

I am using ProGuard with my Android application, what should I do to ensure my Millennial ads still work?

To make sure you still receive ads while using ProGuard, add the following snippet to your proguard.cfg file.

-keepclassmembers class com.millennialmedia.android.* { 
public *; 
} 
-keep class com.millennialmedia.android.**

When using ProGuard and not SpeechKit, add the following line to their proguard-project.txt:

-dontwarn com.millennialmedia.android.NVASpeechKit*

Upvotes: 2

Related Questions