728x90

Contacts Demo 앱을 Android Studio 용으로 변환을 시도한 결과를 적어둔다.


=== build.gradle (Module) ====

 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'
}

 === build.gradle (Project) ====

 buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}


=== AndroidManifest.xml ===

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.prince.contacts"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="AddContact"
            android:label="@string/add"
            android:theme="@android:style/Theme.Dialog" >
        </activity>
        <activity
            android:name="DeleteContacts"
            android:label="@string/delete"
            android:theme="@android:style/Theme.Dialog" >
        </activity>
    </application>

</manifest>


Eclipse 에서 Android Studio 용으로 변환을 하면 주의해서 살펴볼 내용을 위 사항이라고 본다.


jave 소스코드와  Layout 파일은 build.gradle 이 달라짐에 따라서 에러,경고 등이 생길 수 있다.

높은 버전에서 문제없이 코드가 동작되도록 하는 것은 상황에 맞게 수정해야 한다.

블로그 이미지

Link2Me

,