• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    미해결

Cannot fit requested classes in a single dex file (# methods: 105461 > 65536)와 같은 에러가 나는 경우 참고

20.03.07 01:01 작성 조회수 128

0

컨텐츠 데이터  모델차시에서 발생할 수 있는 에러입니다. 아마도 firebase  관련 dependencies가 많아지기 때문에 발생하는 것으로 생각됩니다.(이 에러는 앱에서 참고하는 메서드의 개수가 65536개가 넘는 경우 발생합니다.)

앱이 Androidx 환경에서 작동하는 경우, 이를 해결하기 위해서는 

https://stackoverflow.com/questions/48249633/errorcannot-fit-requested-classes-in-a-single-dex-file-try-supplying-a-main-dex 에서  gsm이 작성한  For Androidx Users,로 시작하는 부분을 참고하시면 됩니다. 

추가되는 건 build.gradle(Module: app)에서  minifyEnabled falseimplementation 'androidx.multidex:multidex:2.0.1'입니다. 

하울님의 howlstagram github에 업로드된 자료에도 위 부분이 추가 되어있습니다.

예시)

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.howlstagram_f16"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
buildToolsVersion "28.0.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-firestore:18.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
}

답변 0

답변을 작성해보세요.

답변을 기다리고 있는 질문이에요.
첫번째 답변을 남겨보세요!