I want to add fused location services but it shows me some error. Help me.
apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion "27.0.1" defaultConfig { applicationId "com.example.adil.bloodbankapplication" minSdkVersion 15 targetSdkVersion 26 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(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:26.1.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.firebase:firebase-auth:11.8.0' compile 'com.google.firebase:firebase-database:11.8.0' compile 'com.android.support:support-v4:26.1.0' compile 'junit:junit:4.12' compile 'com.android.support:design:26.1.0' compile 'com.github.joielechong:countrycodepicker:2.1.5' compile 'com.jaredrummler:material-spinner:1.2.4' compile 'hanks.xyz:htextview-library:0.1.5' compile 'com.firebaseui:firebase-ui-database:1.2.0' compile 'com.google.android.gms:play-services:11.8.0' } apply plugin: 'com.google.gms.google-services'
To Solve Cannot fit requested classes in a single dex file. Try supplying a main-dex list Error You just need to Add dependency androidx. multidex:multidex:2.0.
Android applications by default have SingleDex support which limits your application to have only 65536 methods(references). So multidexEnabled = true simply means that now you can write more than 65536 methods(references) in your application.
None of the answers they gave you was exhaustive. The problem lies in the Multidex. You must add the library in the app gradle :
implementation 'com.android.support:multidex:1.0.3'
After, add in the defaultConfig of the app gradle :
multiDexEnabled true
Your Application must be of the Multidex type.. You must write it in the manifest :
android:name=".MyApplication"
"MyApplication" must be either the Multidex class, or it must extend it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With