andorid socket IO random chat app 글 시작

2022. 11. 26. 04:58android/Random Chatting

!!!!!!!!!Android Radom Chat!!!!!!!!

 

이번 글에서는 Random Chatting 어플을 만드는 첫 글을 작성해보려고 합니다.

 

 

만들면서 겪은 우여곡절을 기록하여

 

 

만드는 과정에서 배운 여러 개의 기능들과 정보들을 공유해보도록 하겠습니다.

 

 

먼저 build setting 과 안드로이드 버전을 알려드리고 다음으로 넣어가겠습니다.

 

 

이번 프로젝트 도중 android studio를 Dolphin을 업데이트 했습니다.

 

 

일단 Project 단위 build.gradle 입니다.

buildscript {
    ext {
        compose_ui_version = '1.3.1'
    }
    dependencies {
        classpath 'com.google.dagger:hilt-android-gradle-plugin:2.44'
    }
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.3.1' apply false
    id 'com.android.library' version '7.3.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
}

다음은 모듈 단위 입니다.

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'dagger.hilt.android.plugin'
    id 'kotlin-kapt'
}

android {
    namespace 'com.dev_musashi.ranchat'
    compileSdk 33

    defaultConfig {
        applicationId "com.dev_musashi.ranchat"
        minSdk 23
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_ui_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
    implementation 'androidx.activity:activity-compose:1.6.1'
    implementation "androidx.compose.ui:ui:$compose_ui_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
    implementation 'androidx.compose.material:material:1.3.1'
    implementation "androidx.navigation:navigation-compose:2.5.3"


    implementation('io.socket:socket.io-client:1.0.1') {
        exclude group: 'org.json', module: 'json'
    }

    implementation "com.google.dagger:hilt-android:2.44"
    implementation "androidx.hilt:hilt-navigation-compose:1.0.0"
    kapt "com.google.dagger:hilt-compiler:2.44"

    implementation "com.github.bumptech.glide:compose:1.0.0-alpha.1"
    implementation "com.github.bumptech.glide:glide:4.14.2"
    kapt "com.github.bumptech.glide:compiler:4.14.2"
    implementation "io.coil-kt:coil-compose:2.2.2"

    implementation 'com.google.code.gson:gson:2.8.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
}

 

안드로이드 스튜디오에서 진행했고 

 

socket 통신을 위해 서버용 node.js를 visual code에서 작성하였습니다.

 

언어는 코틀린이구요.

 

다음 시간에는 비쥬얼 코드 세팅과 연결을 해보도록 하겠습니다.