0

I'm running my flutter project in android emulator. I was facing the following error. Screenshot attached.

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Error running com.******.swivy. Manifest versionCode not found
Unable to read manifest info from /Users/muruganandham.kuppan/swivy/build/app/outputs/apk/app.apk.
No application found for TargetPlatform.android_x86.
Is your project missing an android/app/src/main/AndroidManifest.xml?
Consider running "flutter create ." to create one.

enter image description here

But, I can see the AndroidManifest.xml file in respective file path.

Muruganandham K
  • 5,271
  • 5
  • 34
  • 62

3 Answers3

4

This may happen if you had deleted versionCode and versionName in your build.gradle(app).

defaultConfig {
    applicationId "com.example.package"
    minSdkVersion 16
    targetSdkVersion 29

    // make sure you have these two variables
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName 
}
iDecode
  • 22,623
  • 19
  • 99
  • 186
0

This answer helped me.

solved it by generating a debug.keystore and registering it inside the app on Firebase. Don't forget to download the new google-services.json after that.

See also https://developers.google.com/android/guides/client-auth

Muruganandham K
  • 5,271
  • 5
  • 34
  • 62
0

The problem here is what I think is a bug in the flutter create templates. In the build.gradle files they create, they have these stanzas:

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
   throw new GradleException("versionCode not found. Define flutter.versionCode in the local.properties file.")
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')

The workaround for this is to change the lines in your build.gradle from something like this:

android {
compileSdkVersion 27

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 27
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 }
}

to something like this:

android {
compileSdkVersion 27

defaultConfig {
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 }
}

and remove the flutterVersionCode and flutterVersionName stanzas.

The fix to the bug will probably be something like defaulting to a value if the version information isn't in the local.properties.

got it from this link https://github.com/flutter/flutter/issues/18983

A.Mushate
  • 395
  • 3
  • 7