I use Proguard to obfuscate my code, and make it smaller. I build using Eclipse, and have for some time. I\'ve recently had a build that works great in the debug version, wh
Summary: I'm pretty sure the key problem was the folder with the /java
source folder instead of /src
. Make sure any dependent libraries have their source code in a /src
folder, if at all possible.
As I hinted in my edit, I believe this is a memory problem. In fact, I was able to get the build built with a lot of trial and error, and a few adjustments made to my eclipse memory configuration. Specifically, I used the advice from this article, namely:
-Xmx256m
to -Xmx2048m
in the eclipse.ini file.-Xms256M -Xmx512M
to the JVM, found at Window-> Preferences -> Java -> Installed JREs -> clicking on JRE -> Edit-ignorewarnings
. That just masked the problem, I would have figured out what was going on a lot earlier if I hadn't done that. -dontwarn
for the known issues (A lib I use optionally uses java.awt
, but not for the stuff I use...These steps helped, but in the end, I was able to fix it, although I did several things all at once, any of which could have fixed the problem. The things I did:
My project.properties looks like this now:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19
android.library.reference.1=../../../workspace/android-support-v7-appcompat
android.library.reference.2=..\\..\\..\\workspace\\google-play-services_lib
android.library.reference.3=..\\..\\..\\Documents\\GitHub\\android-styled-dialogs\\library\\src\\main
android.library.reference.4=..\\..\\..\\Documents\\GitHub\\drag-sort-listview\\library
android.library.reference.5=..\\..\\..\\Documents\\GitHub\\android-maps-utils\\library
I occasionally receive reports about missing classes when building with ProGuard in Eclipse, in Windows. The cause is a mystery so far. ProGuard is run as a separate script/java process inside Eclipse. The problem happens spuriously. I am guessing the compiled class files aren't flushed to the file system in time for ProGuard to read them. You could try adding a pause or just list the files in the ProGuard script android-sdk/tools/proguard/bin/proguard.bat.
I have not received any similar reports about Ant or Gradle, so those may be practical alternatives.
(I am the developer of ProGuard)
Right now you have
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
Your classes extend the support library v7 (judging from your project.properties) not the standard android.app.Activity, so you need something like:
-dontwarn android.support.v7.**
-keep public class * extends android.support.v7.app.Fragment
-keep public class * extends android.support.v4.app.Activity
or if you want to try to keep more (but bigger final apk):
-keep class android.support.v7.** { *; }
or
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.support.v7.app.ActionBarActivity {
public void *(android.view.View);
}
and the same for Fragment
s etc
Note your log says Cannot find LogBookFragment$OnEditView
which is an inner class View. Either list these one by one to save by proguard or move them out into their own class file.