I used Joda time API in my android project, my project didn't compile when i export a signed apk, it showing the error "Proguard returned with error code 1. See console", below is the error log,
[2013-07-20 00:50:25 - CC] Proguard returned with error code 1. See console
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.DateMidnight: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.DateTime: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Days: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Days: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Duration: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Hours: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Hours: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Instant: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.LocalDate: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.LocalDate: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.LocalDateTime: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.LocalDateTime: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.LocalTime: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.LocalTime: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Minutes: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Minutes: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.MonthDay: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.MonthDay: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Months: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Months: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.MutableDateTime: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.MutableDateTime: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.MutablePeriod: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Period: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Seconds: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Seconds: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Weeks: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Weeks: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.YearMonth: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.YearMonth: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Years: can't find referenced class org.joda.convert.FromString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.Years: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.base.AbstractDuration: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.base.AbstractInstant: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] Warning: org.joda.time.base.AbstractPeriod: can't find referenced class org.joda.convert.ToString
[2013-07-20 00:50:25 - CC] You should check if you need to specify additional program jars.
[2013-07-20 00:50:25 - CC] Warning: there were 37 unresolved references to classes or interfaces.
[2013-07-20 00:50:25 - CC] You may need to specify additional library jars (using '-libraryjars').
[2013-07-20 00:50:25 - CC] java.io.IOException: Please correct the above warnings first.
[2013-07-20 00:50:25 - CC] at proguard.Initializer.execute(Initializer.java:321)
[2013-07-20 00:50:25 - CC] at proguard.ProGuard.initialize(ProGuard.java:211)
[2013-07-20 00:50:25 - CC] at proguard.ProGuard.execute(ProGuard.java:86)
[2013-07-20 00:50:25 - CC] at proguard.ProGuard.main(ProGuard.java:492)
my proguard.cfg file looks like,
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
can anyone help me on this? i need to publish my app. the solution will be appreciated. thanks in advance.
If the missing classes aren't needed, you can suppress the warnings:
-dontwarn org.joda.convert.**
See the ProGuard manual > Troubleshooting > Warning: can't find referenced class
Based on the post here: https://plus.google.com/112998433182673852267/posts/ApBBBjv9szw
What is actually happening is that the missing "FromString" class is an annotation that is not actually present as a class file in joda-time-2.0.jar. There's a claim (http://www.scala-lang.org/node/10575) that a missing annotation class file is not supposed to affect compilation, which sounds correct, but I don't know where this is formally stated.
You'll need to add http://joda-convert.sourceforge.net/ to your project's build path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With