I am getting the error in my flutter project when implementing google sign in
Make sure your app migrated to androidx
.(gradle.properties
file contains line android.useAndroidX=true
)
Also this error may be related to apk-file size (over 64K limit) on old Android devices (API < 21). Either change minSdkVersion
to 21+, or configure your app for multidex.
In module-level build.gradle
file add the multidex
library as a dependency:
android { defaultConfig { ... minSdkVersion 15 targetSdkVersion 29 multiDexEnabled true } ...}dependencies { ... implementation 'androidx.multidex:multidex:2.0.1'}
I don't know if you've resolved this, but here is how I fixed a similar issue.
Added the multidex dependency in the build.gradle(app) file of the android part.
dependencies { ... implementation 'androidx.multidex:multidex:2.0.1' }
Also add this line of code in the same build.gradle file.
defaultConfig { ... multiDexEnabled true }
Extend the FlutterApplication class and enable the MultiDex class there.
class MyFlutterApp: FlutterApplication() { override fun attachBaseContext(base: Context?) { super.attachBaseContext(base) MultiDex.install(this) } }
Then add the class to your manifest.
<application android:name=".MyFlutterApp" ... </application>
This should fix your issue.