Add your Android Studio project to BitBucket

So, I had this Android Studio project in svn, and I wanted to migrate it to Bitbucket. I’m using Ubuntu 13.10 and Android Studio 0.5.4.

Bitbucket currently has this awesome free plan for private projects up to 5 users, which is a great deal for starting up.

So, first things first:

0: register to Bitbucket
1: create the empty project repo in BitBucket, give it the name of your Android project
2: in your terminal, move to the root directory of the project you want to move to git.
2a: in my case, I deleted all svn directories and files, because I don’t want git to index also those files
3: $ git init
4: $ git add .
5: $ git commit -m "initial commit"

These steps created the local git repository. Now let’s load all into the remote Bitbucket repository:

6: git remote add origin https://<username>@bitbucket.org/<username>/<projectname>.git
7: git push -u origin
8: git push -u tags

Now the project have been uploaded.

Open your local project in Android Studio, go File -> Settings… -> Version Control, specify “git” as Project version control.

If you come from svn, remember to click “Commit and push”, not only “Commit” to upload your changes.

Pubblicato in Android Studio | Contrassegnato , , , | Lascia un commento

Android assets folder in AS 0.4.2

The “assets” folder doesn’t exist in the project tree created by Android Studio wizard, anyway it is already declared in the <app>.iml file:

<configuration>
    ...
    <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>

Therefore you just need to create the “assets” folder under src/main/

Pubblicato in Android Studio | Contrassegnato , | Lascia un commento

Adapting projects to Android Studio 0.3

Android Studio 0.3 requires Gradle 1.8. Make sure that:

in the project module’s build.gradle the following line points to gradle 0.6.+
classpath 'com.android.tools.build:gradle:0.6.+'
In the gradle-wrapper.properties, the next line points to gradle 1.8:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip

That’s pretty much it.

Pubblicato in Uncategorized | Contrassegnato , | Lascia un commento

Storing currency in a SQlite database

Use BigDecimal to represent currency and money.

BigDecimal b = new BigDecimal();
String s = b.toPlainString();

Then when you pull it from the database you can create a new BigDecimal.

BigDecimal c = new BigDecimal(String s)
Pubblicato in Uncategorized | Contrassegnato , , | Lascia un commento

Fat fonts on Swing related applications

After installing Wine on Ubuntu 13.10, i got bold fonts all over Android Studio 0.3.

Looks like there’s already a bug opened about this in Launchpad.

Removing fonts-unfonts-core worked.

Pubblicato in Uncategorized | Lascia un commento