티스토리 뷰

원래는 좀 연습을 하고 내용을 정리해서 올리려 했으나 

온갖 버그가 다 튀어나와서 난리난 덕분에 

나중에 Realm 사용 방법을 올리도록 하겠습니다.

이번 포스트는 오직 Bundle쪽 설치만 다룹니다. (사용 방법X, 설명X)

 

그래서 무슨 버그였냐고요?

 

Didn't find class ... on path: DexPathList[[....]]

버그 전문 아닙니다.

고치긴 했는데 정확히 어느 부분 덕에 고친건지

저도 모르는 관계로 일단 통으로 올려드립니다. 

(나중에 시간 여유 생기면 정리할께요.)

 

보시고 차이점(?)을 비교하시면 고치실 수 있을꺼에요

 

build.gradle(ProjectName)

buildscript {
    dependencies {
        classpath 'io.realm:realm-gradle-plugin:10.8.0'
    }
}

plugins {
    id 'com.android.application' version '7.4.1' apply false
    id 'com.android.library' version '7.4.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false

}

 

build.gradle(:app)

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'realm-android'

}
android {
    namespace 'com.example.mywalkproject'
    compileSdk 32

    defaultConfig {
        applicationId "com.example.mywalkproject"
        minSdk 26
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'com.android.support:multidex:1.0.3'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

MyApplication.kt

class MyApplication : MultiDexApplication() {//선언
    override fun onCreate() {
        super.onCreate()
        Realm.init(this)
        val config : RealmConfiguration = RealmConfiguration.Builder()
            .name("walk_calendar.realm")
            .deleteRealmIfMigrationNeeded()
            .build()
        Realm.setDefaultConfiguration(config)

    }
}

AndroidManifest.xml

// 아까 만든 class 적용
<application
    android:name=".MyApplication"

 

저도 여러가지 시도를 하던중 고쳐진 거라

아직 정확히 어느 부분때문에 고쳐진건지 모르겠어요...

하지만 혹시라도 저처럼 해메시는 분들이 있다면 참고하시라고 올려봅니다. 

 

나중에 시간여유가 생기면 다시 정리하겠습니다. 

오늘도 파이팅입니다.

댓글