728x90

모듈을 추가하는 것은 Contacts Demo 파일을 순수하게 Android Studio 버전에서 생성하는 과정이라고 볼 수 있다.

모듈 추가 과정을 상세하고 보고 싶다면 확인해라.


이제 build.gradle 부분이 http://link2me.tistory.com/1304 와 어떻게 다른지 살펴보자.


apply plugin: 'com.android.application'

android {
    compileSdkVersion 15
    buildToolsVersion "25.0.3"

    defaultConfig {
        applicationId "com.prince.contacts"
        minSdkVersion 8
        targetSdkVersion 15
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
}

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        applicationId "com.tistory.link2me.contacts_demo_for_studio"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}


build.gradle 부분이 다른 걸 확인했으니 코드를 복사해서 붙여넣기 했더니 문제없이 잘 동작한다.

다만, AndroidMenifest.xml 에서 약간 수정할 부분이 좀 있었다.


첨부된 소스코드는 Android Studio 에서 완전히 작성된 코드라고 보면 된다.


Contact_Demo.zip



Eclipse 버전의 샘플 소스는 http://link2me.tistory.com/1301 에 올려져 있다.


블로그 이미지

Link2Me

,