Adding a jar to Android Studio

Should be pretty simple right?
Well, the UI doesn't support it right now but it is pretty simple to handle manually, so you'll have to open your build.gradle file that should be in:
/projectName/

And add the following:
dependencies {
    compile files('libs/jarFileName.jar')
}


Example:

buildscript {
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

dependencies {
    compile files('libs/android-support-v4.jar')
    compile files('libs/MixpanelAPI.jar')
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 16
    }
}

Android layout shadow without 9 patch

Applying shadows to android layouts without using a 9-patch on android 4.3 and below! (4.4 changed toast design)

Using a 9-patch is (sometimes) too much of a pain in the buttocks, when all you want is just a simple shadow, CSS has it, so why doesn't android??? Grrrrr...!

I found a hack.

While working on Mr.Query, I was looking for a built-in android icon because I was too lazy to design a new one.

Then, I stumbled upon:
                android:background="@android:drawable/toast_frame"

                android:background="@android:drawable/dialog_frame"



I tried it on a few different layouts and buttons, and it's not bad!

Here are a few examples:




<TextView
            android:layout_width="fill_parent"
            android:text="I am a simple textview with a shadow"
            android:layout_height="wrap_content"
            android:textSize="18sp"
            android:padding="16dp"
            android:textColor="#fff"
            android:background="@android:drawable/toast_frame"
            />

    <LinearLayout
            android:layout_height="64dp"
            android:layout_width="fill_parent"
            android:gravity="center"
            android:background="@android:drawable/toast_frame"
            android:padding="4dp"
            >
        <Button
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="Button shadow"
                android:background="#33b5e5"
                android:textSize="24sp"
                android:textStyle="bold"
                android:textColor="#fff"
                android:layout_gravity="center|bottom"
                />

    </LinearLayout>

    <LinearLayout
            android:layout_height="64dp"
            android:layout_width="fill_parent"
            android:gravity="center"
            android:background="@android:drawable/toast_frame"
            android:padding="4dp"
            >
        <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="color textView with LinearLayout shadow"
                android:background="#f2eee8"
                android:textSize="18sp"
                android:padding="4dp"
                android:textColor="#111"
                android:layout_gravity="center|bottom"
                />

    </LinearLayout>


Made with hilite

Run Lint on Android Studio

Android Lint is a tool that scans Android project sources for potential bugs.
For example, it can find unused resources.
To run it on Android Studio:
Top menu-> Analyze-> Inspect code

To run it on a specific module, make sure the specific module is selected in the Project tab.