How to import Android packages into the new Android module?

I am new to Android programming and new to Studio (0.4.4). For the first time I found a class that I wanted to include in my project. In another SO tip here, I created a new module with the same name, and then replaced the Java template with a new class. So far so good.

Unfortunately, although it can find and import java classes. *, it cannot find and import any android classes. *, in particular, android.os.SystemClock and android.util.Log. (for example, “Cannot resolve the X”.) What steps must be taken to find and import them? Thanks for any help.

enter image description here

Updated build.gradle:

apply plugin: 'java'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:+'
}
+3
source share
1

Android , Android. build.gradle :

apply plugin: 'android-library'

:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.8.+'
    }
}

, build.gradle , ; , .

android-library AndroidManfiest.xml Android - . , , , - , , .

+3

All Articles