Running out of heap running Proguard in Android Gradle build - build

When I try to run Proguard on my local machine from within my Gradle build, I get a "Java heap space" error. Specifically:
:<app_name>:proguardRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<app_name>:proguardRelease'.
> Java heap space
I tried setting my GRADLE_OPTS=-Xmx2048m, but I'm still getting the heap space error.
Any suggestions?
Here's the end of my log output:
:Tinder:proguardRelease
ProGuard, version 4.9
Reading input...
Reading program directory [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/classes/release]
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/library.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/androidannotations-api-2.7.1.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/picasso-1.1.1.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/gcm.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/ViewPagerIndicator.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/nineoldandroids.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/crittercism_v3_0_11_sdkonly.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/google-play-services.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/facebook.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/PullToRefresh.aar/classes.jar] (filtered)
Reading program jar [/Applications/android-studio.app/sdk/extras/android/m2repository/com/android/support/support-v4/13.0.0/support-v4-13.0.0.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/apphance-library.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/simple-crop-image-lib.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/windowed-seek-bar.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/com.kontagent.android.sdk.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/ActionBarSherlock.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/google-play-services_lib.aar/classes.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/libs/gson-2.2.4.jar] (filtered)
Reading program jar [/Users/jabdulius/Documents/Dropbox/workspace-tinder/Tinder/build/exploded-bundles/volley.aar/classes.jar] (filtered)
Reading library jar [/Applications/android-studio.app/sdk/platforms/android-17/android.jar]
:Tinder:proguardRelease FAILED

Did you also export the environment variable (on Linux and BSD)?
export GRADLE_OPTS=-Xmx2048m

If someone runs into this problem within AndroidStudio, without Gradle, the solution is to add some memory to proguard :
Android Studio >> Preferences >> Compilers >>
Android Compiler >> Proguard Options = -Xmx2048m

Related

How to display Minidump stack traces on Mac OSX?

I've written a small test program which throws a C++ exception. I've setup Breakpad to write a minidump on this thrown exception. I now have a .dmp file I'd like to see the stack trace for. Several references indicate I should.
Generate a .sym file using Breakpad's 'dump_syms' utility program, which I've done. I'm running dump_syms on the debug binary (which should have the debug symbols built in?). ./dump_syms breakpad_testing > breakpad_testing.sym
At this point I have the .dmp file and the .sym file
Inspect the first line of the .sym file to view to get a binary version hash? This will look something like this -
MODULE mac x86_64 ED3C7C3C3C283C749036117557E0A8500 breakpad_testing.
Use this to create an expected folder structure mkdir -p
./symbols/breakpad_testing/ED3C7C3C3C283C749036117557E0A8500 and
move the .sym file there. mv breakpad_testing.sym
./symbols/breakpad_testing/ED3C7C3C3C283C749036117557E0A8500
Show stack using 'minidump_stackwalk' tool. minidump_stackwalk
breakpad_testing.dmp ./symbols
However these steps don't seem to have any effect on the output of minidump_stackwalk, I still see output lines such as minidump.cc:2122: INFO: MinidumpModule could not determine version for /Users/mb/Library/Developer/Xcode/DerivedData/<blah>/Build/Products/Debug/breakpad_testing and an unsymbolicated stack trace.
Is there something I'm misunderstanding or not using properly regarding Breakpad on OSX?
This is one of the references I've been following https://blog.inventic.eu/2012/08/qt-and-google-breakpad/

Exit 1 when calling mono_jit_init

Hi, I try to embed mono in a c++ application on windows. I followed http://www.mono-project.com/docs/compiling-mono/windows/ and I have my headers, lib and dll built for win64.
I wrote a simple app that just calls
MonoDomain *domain;
domain = mono_jit_init("ConsoleApplication1.exe");
Everything builds and link find but when I run my program, I can break and step until the mono_jit_init call. Then the apps performs an exit1 and I can't see what's wrong.
I tried both release and debug.
Any ideas on how to find the issue? Properly embed mono?
Thanks, JNQ
Your application probably fails on loading Mono libraries.
You can use Process Monitor (https://learn.microsoft.com/en-us/sysinternals/downloads/procmon) to find out what exactly fails for you:
Run Process Monitor
Set Process Monitor filter to "[Process Name] [is] [Your process name, e.g. ConsoleApplication1.exe] then [Include]"
Run you program and lookup for "CreateFile" operations with "NAME NOT FOUND" Result and see Path column to find out what file is missing
In my case it was a failure on loading mono mscorlib.dll from lib\mono\4.5\mscorlib.dll so copying the files from the Mono installation to the path pointed by Process Monitor has helped.

kcachegrind unable to open callgrind file

I'm using callgrind to profile a small piece of code. Callgrind output files are well generated, their content looks ok, but I'm unable to open them with kcachegrind: I get the following error message:
Could not open file "callgrind.out.4953". Check it exists and you have enough permissions to read it.
I have all permissions on files and directories they are in, but with the same issue. Also, it works well with an other project, in an other folder in the same workspace. I also precise that the processes terminate correctly in both cases.
I recently reported to the kcachegrind developer a problem with exactly the same symptoms. The problem is triggered when callgrind is used with a very long command line. This was fixed in the next versions of valgrind/callgrind and kcachegrind.
Find below the commit log for the valgrind side.
Waiting for the new releases of valgrind and kcachegrind, if your problem
is also due to a too long command line, you can just edit the file and truncate the cmd: line.
If your problem is not the length of the cmd line, then I guess you will need to use callgrind_annotate (if this work) or further investigate why kcachegrind finds your file problematic.
Author: weidendo Date: Tue Jan 10 20:21:21 2017 New Revision: 16196
Log: Add a format marker to callgrind files
KCachegrind currently uses a quick format detection before actually
loading a file, and checks for a line starting with "events:" in the
first 2kB for that. This obviously is fragile, as shown by an internal
bug report by Philippe: before the "events" line, Callgrind puts a
"cmd:" line with the command line. If this is very long, the detection
fails and the file does not get loaded at all.
While KCachegrind would not need to have this quick format check at
all, it is useful if multiple input format filters get supported at
some point, to automatically select the correct filter.
Further, for the "file" command, for file managers and desktop
environments, having an unique way to detect a file format is
important.
It is not too late to fix this issue for the callgrind format.

Why does my Codename One build fail with a StackOverflowError?

I'm trying to build my application for J2ME using the Codename One build server. This has been working fine, but now I get a build error every time. Here's an extract from the log, which mentions a StackOoverflowError while preparing the output jar:
Preparing output jar [/tmp/build8143824389622734358xxx/result/MyApplication.jar]
Copying resources from program directory [/tmp/build8143824389622734358xxx/tmpclasses]
Exception: java.lang.StackOverflowError
com.codename1.build.daemon.Executor.unzip(Executor.java:904)
com.codename1.build.daemon.Executor.unzip(Executor.java:904)
com.codename1.build.daemon.Executor.unzip(Executor.java:904)
com.codename1.build.daemon.Executor.unzip(Executor.java:904)
com.codename1.build.daemon.Executor.unzip(Executor.java:904)
com.codename1.build.daemon.Executor.unzip(Executor.java:904)
That last line then repeats another 1023 times, all the way to the end of the file.
I've rewound my source to a version that I have built before and that now fails too, with the same error message.
Could this be something that's changed in my development environment, or is this an issue with the build server?
Any help would be much appreciated. Thanks a lot,
Paul
There was a temporary issue with some iOS builds. It was resolved in an hour.

What needs to be done to get a distributable program from Eclipse?

I’ve produced a C++ program in Eclipse running on Redhat, which compiles and runs fine through Eclipse.
I thought that to run it separately to Eclipse you use the build artifact which is in the directory set via the project’s properties.
However this executable doesn’t run (I know it’s an executable as I’ve set it to be an executable via the project’s properties and it shows up as such via the ls command and the file explorer).
When attempting to run it using the executable’s name, I get the error:
bash: <filename>: command not found
When attempting to run it as a bash file:
<filename>: <filename>: cannot execute binary file
And when running it with "./" before the file name, nothing happens. Nothing new appears in the running processes and the terminal just goes to the next line as though I’d just pressed enter with no command.
Any help?
You've more or less figure out the first error yourself. when you just run <filename> , it is not in your PATH environment variable, so you get "command not found". You have to give a full or relative path when to the program in order to run it, even if you're in the same directory as the program - you run it with ./<filename>
When you do run your program, it appears to just exit as soon as you start it - we can't help much with that without knowing what the program does or see some code.
You can do some debugging, e.g. after the program just exits run echo $? to see if it exited with a particular exit value, or run your program using the strace tool to see what it does (or do it the usual way, insert printf debugging, or debug it with gdb)