Reputation: 109
I've installed the Facebook SDK and has no errors but I can't seem to export it as part of my android project. I get the below error when enabling ProGuard:
Warning: com.facebook.applinks.FacebookAppLinkResolver$2: can't find referenced class bolts.Task$TaskCompletionSource
Warning: com.facebook.applinks.FacebookAppLinkResolver$2: can't find referenced class bolts.AppLink$Target
Warning: com.facebook.applinks.FacebookAppLinkResolver$2: can't find referenced class bolts.AppLink
Warning: com.facebook.applinks.FacebookAppLinkResolver$2: can't find referenced class bolts.AppLink$Target
Warning: com.facebook.messenger.MessengerUtils: can't find referenced class bolts.AppLinks
Warning: com.facebook.messenger.MessengerUtils: can't find referenced class bolts.AppLinks
You should check if you need to specify additional program jars.
Warning: there were 62 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 added the below to my ProGuard file but I still get the error:
-keep class com.facebook.** {
*;
}
How should I configure ProGuard to use the Facebook SDK?
Upvotes: 2
Views: 549
Reputation: 967
I am using these settings in my proguard-project.txt:
# Facebook Audience Network
-keep class com.facebook.ads.** { *; }
-keep class com.facebook.ads.internal.** { *; }
-keep class com.google.ads.mediation.facebook.FacebookAdapter {*;}
-keep class com.google.android.exoplayer.** {*;}
-dontwarn com.facebook.ads.**
-dontwarn com.google.android.exoplayer.**
Upvotes: 3
Reputation: 8188
ProGuard is telling you that the Facebook SDK references classes in the bolts
package but ProGuard can't find those classes because, most likely, you're not including Bolts in your application.
To fix this, you can either:
Tell ProGuard to ignore the missing dependency by adding the line
-dontwarn bolts.**
to the ProGuard configuration file. Doing this shouldn't cause a problem because the Facebook SDK can detect internally whether Bolts is present and only try to use it in that case.
Add Bolts as a dependency of your project by putting these lines in your Gradle file:
dependencies {
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.parse.bolts:bolts-applinks:1.4.0'
}
Option 1 is probably the best choice unless you actually need Bolts.
Upvotes: 0