Closed ndson040496 closed 1 week ago
Hey @ndson040496, I just ran the same command for the auth example app. It was successful:
[+1326 ms] β Built build/app/outputs/flutter-apk/app-debug.apk.
[ ] "flutter apk" took 51,421ms.
[ +123 ms] ensureAnalyticsSent: 107ms
[ ] Running 0 shutdown hooks
[ ] Shutdown hooks complete
[ +18 ms] exiting with code 0
It looks like you have a configuration issue, looking at your build logs:
ββ Flutter Fix
β [!] The shrinker may have failed to optimize the Java bytecode. β
β To disable the shrinker, pass the `--no-shrink` flag to this command. β
β To learn more, see: https://developer.android.com/studio/build/shrink-code β
This article might be of assistance to you: https://stackoverflow.com/questions/60745249/the-shrinker-may-have-failed-to-optimize-the-java-bytecode
I have added --no-shrink
to the command but it still fails
flutter build apk --debug --verbose --no-shrink
Also added the no shrink options to config to build.gradle
, but no luck:
buildTypes {
release {
signingConfig signingConfigs.debug
shrinkResources false
minifyEnabled false
}
}
The article mostly points to the minSdkVersion
which I already set to 21 (already tried with every number from 21 to 34, all fail).
The Java version on my Mac is Java 21, could this be the reason? should I downgrade it to Java 8 so that it matches the one in build.gradle
?
I doubt downgrading is the fix, but worth a try. I am on Java 17 if that helps.
@russellwheatley Java 17 solved the problem for me. So looks like flutterfire
is not compatible with newer Java
Is there an existing issue for this?
Which plugins are affected?
Core, Auth
Which platforms are affected?
Android
Description
My project couldn't build to Android after adding
firebase_core
andfirebase_auth
. iOS and Web can still build and run just fine.Logs for
`flutter build apk --debug --verbose
: Terminal Saved Output.txtWhat I tried:
minSdkVersion
to 21multidex
withimplementation 'com.android.support:multidex:2.0.1'
andmultiDexEnabled true
(not required by SDK 21, but I still tried).Reproducing the issue
build.gradle
:def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } }
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' }
def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' }
android { namespace "com.sseo.app_incent" compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion
}
flutter { source '../..' }
dependencies {}
name: app_incent description: "A new Flutter project." publish_to: 'none' version: 0.1.0
environment: sdk: '>=3.3.4 <4.0.0'
dependencies: firebase_auth: 4.19.4 firebase_core: 2.30.1 flutter: sdk: flutter flutter_localizations: sdk: flutter go_router: 14.0.0 intl: any
dev_dependencies: flutter_test: sdk: flutter flutter_lints: 3.0.2
flutter: assets: