Android Studio + gradle + Windows 7

Android Studio + Windows 7 + gradle = Gradle project sync failed error

I always got the error below in my log file

 Error occurred during initialization of VM
 Could not reserve enough space for object heap
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.


I tried many solutions, as clean project, remove .idea file/folder, restart Android Studio, but no one of those worked for me.

After many trials, I got the final solution, and it perfectly works for me! You need to modify the Xmx value, follow the steps:

  1. Control Panel
  2. System
  3. Advanced(tab)
  4. Environment Variables
  5. System Variables
  6. New
 Variable name: _JAVA_OPTIONS
 Variable value: -Xmx512M


…and your nightmare disappears!

Uninstall Applications using ADB

If you need to uninstall an App on your phone, you can do it using adb (Android Debug Bridge).

The path to execute adb is <sdk>/platform-tools

adb uninstall <package name>


Tip. To get in the sdk folder, try to execute “cd $ANDROID_HOME

Windows 7.. or maybe not

I use Windows 7 on my PC and today I see a really funny thing… typical of Windows.

As I said, I use Windows 7, but seems “they” forget to change a text on Disk Cleanup window :) …Now I’m confuse, maybe I have Windows Vista and I never knew it!


How to ignore “KEY is not translated in LANGUAGE” in Eclipse

If you are using Eclipse, go in Window -> Preferences -> Android -> -Lint Error Checking and find Missing Translation. Change the value to Warning and apply it.



Otherwise, you can create a lint.xml file in your project like this:

<?xml version="1.0" encoding="UTF-8"?>
    <issue id="ExtraTranslation" severity="warning" />
    <issue id="MissingTranslation" severity="warning" />

It’s very..

It’s very easy to be different,

but very difficult to be better.


Jonathan Ive

CxxTest – Quick start guide

CxxTest is a unit testing framework for C++ that is similar in spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because it does not require precompiling a CxxTest testing library, it employs no advanced features of C++ (e.g. RTTI) and it supports a very flexible form of test discovery. [ref. CxxTest]

In this guide, I’ll explain how to create and execute a TestSuite using CxxTest. Let’s start.

1. Download last CxxTest release form here, uncompress it and insert into the same folder of your project. Now you have a new folder in your project called cxxtest_<release_number>

2. Let’s create our first TestSuite (TestSuite1.h).

#include <cxxtest/TestSuite.h>
class TestSuite1 : public CxxTest::TestSuite
  public: void testAddition( void )
          TS_ASSERT( 1 + 2 > 0 );
          TS_ASSERT_EQUALS( 1 + 2, 3 );
To check the assertion list, visit

3. After create our TestSuite file, we have to create the executable file. So, let’s open the shell and go in your project folder, then type as follow:

> python cxxtest_<release_number>/bin/cxxtestgen --error-printer -o test1.cpp TestSuite1.h
> g++ -I cxxtest_<release_number>/ test1.cpp -o test
> ./test

In our case, the output of ./test file is Running cxxtest tests (1 test)..OK!


It might be useful (possible errors)

I got some errors during the process to create the executable file.

1. No tests defined
No tests defined

This was caused by switching .H and .CPP file

  • wrongpython cxxtest_<release_number>/bin/cxxtestgen –error-printer -o TestSuite1.h test1.cpp
  • right:   python cxxtest_<release_number>/bin/cxxtestgen –error-printer -o test1.cpp TestSuite1.h
2. References
test1.cpp:8:34: error: cxxtest/TestListener.h: No such file or directory
test1.cpp:9:33: error: cxxtest/TestTracker.h: No such file or directory
test1.cpp:10:32: error: cxxtest/TestRunner.h: No such file or directory
test1.cpp:11:38: error: cxxtest/RealDescriptions.h: No such file or directory
test1.cpp:12:30: error: cxxtest/TestMain.h: No such file or directory
test1.cpp:13:34: error: cxxtest/ErrorPrinter.h: No such file or directory

This was caused by wrong cxxtest folder when you create the executable file.

  • wrong: g++ -I cxxtest_<wrong_path>/ test1.cpp -o test
  • right:   g++ -I cxxtest_<release_number>/ test1.cpp -o test


3. Create executable file
ld: file too small for architecture x86_64
collect2: ld returned 1 exit status

This was caused by omitting -o parameter while create executable file.

  • wrong: g++ -I cxxtest_<release_number>/ test1.cpp test
  • right:   g++ -I cxxtest_<release_number>/ test1.cpp -o test

If you think..

If you think you are too small to make a difference, 

try sleeping with a mosquito.


Dalai Lama

iOS testing

In this post you can get some info about iOS app testing. After tried some tools about iOS testing, I focused my effort in KIF (for UI testing) and GHUnit (for unit testing). Using those 2 tools, I’m able to test almost any part/piece of an iOS app. Let’s see a bit more in detail how those tools work.


KIF (UI testing)

It is an Integration Testing Framework, which stands for Keep It Functional. It uses accessibility label to create automation of iOS app. KIF runs into your iOS phone and simulator too. Tests are written in Objective-C.

There are 3 classes in KIF to write tests, a Controller, a Scenario and a Step.

The Controller (KIFTestController) is composed of a list of Scenarios (KIFTestScenario),  whereas a Scenario is composed of a list of Steps (KIFTestStep). A step is a simple action which is used to imitate a user interaction.

Note: KIF uses undocumented APIs, so do not make it into production code otherwise your app submission will be denied by Apple.

To install KIF, see git url:


Example (from

 # File Controller

#import “EXTestController.h”

#import “KIFTestScenario+EXAdditions.h


@implementation EXTestController


- (void)initializeScenarios;


[self addScenario:[KIFTestScenario scenarioToLogIn]];

// Add additional scenarios you want to test here





#Scenario (list of steps)

#import “KIFTestScenario+EXAdditions.h”

#import “KIFTestStep.h”

#import “KIFTestStep+EXAdditions.h”


@implementation KIFTestScenario (EXAdditions)


+ (id)scenarioToLogIn;


KIFTestScenario *scenario = [KIFTestScenario scenarioWithDescription:@"Test that a user can successfully log in."];

[scenario addStep:[KIFTestStep stepToReset]];

[scenario addStepsFromArray:[KIFTestStep stepsToGoToLoginPage]];

[scenario addStep:[KIFTestStep stepToEnterText:@""

intoViewWithAccessibilityLabel:@"Login User Name"]];

[scenario addStep:[KIFTestStep stepToEnterText:@"thisismypassword"

intoViewWithAccessibilityLabel:@"Login Password"]];

[scenario addStep:[KIFTestStep stepToTapViewWithAccessibilityLabel:@"Log In"]];


// Verify that the login succeeded

[scenario addStep:[KIFTestStep



return scenario;





GHUnit (Unit  testing)

 It is a test framework for Mac OS X and iOS. Tests are written in Objective-C. GHUnit allows you to (a list of the important functionality):

  • Run tests, breakpoint and interact directly with the XCode Debugger
  • Run test in  parallel
  • View logging, stack traces and debugging information by test case
  • Run a specific test or the whole test suite

To install, see git url:




#import <GHUnitIOS/GHUnit.h>


@interface ExampleTest : GHTestCase { }



@implementation ExampleTest


- (void)testExample


// Do something..

GHTestLog(@”I’m doing something..”;


// .. and compare the result.

if ( […] )


GHTestLog(@”Test failed!”);

GHAssertTrue(NO, @”Error. Test failed!”);


GHTestLog(@”Test passed!”);







KIF iOS – Dismiss Alert

How to dismiss UIAlertView with a button title? There is no assigned step that can be used to do it, so I spent some time before find how to do. The alert buttons’ accessibility label are the same as their titles.

So if you need to tap the alert in the image you need to execute the following step:

scenario addStep:[KIFTestStep stepToTapViewWithAccessibilityLabel:@"OK"]]



Impara il Cinese con la prima App Italiana


Sei un italiano e vuoi imparare il Cinese? Nel market Android trovi solo App in Inglese e nessuna in italiano? Allora sei capitato nella pagina giusta per te!

Oggi è stata rilasciata la nuova versione dell’App CiIta (Cinese per Italiani) con una grafica e una User Experience totalmente rinnovata.

Non sei ancora convinto? Scarica la versione di prova da Google Play Store.