Android Flutter Project - cant generate .apk

SANJISH KUMAR

New member
Jan 12, 2019
1
0
1
Visit site
Hi,
Just started developing a contacts app in flutter using android studio Iguana , but i ran into this error
Error: Gradle build failed to produce an .apk file. It's likely that this file was generated under E:\flutter_notes\contact_app_with_firebase\contacts_app\build, but the tool couldn't find it.

My Project level build.gradle file

plugins {
// ...

// Add the dependency for the Google services Gradle plugin
id("com.google.gms.google-services") version "4.4.1" apply false

}


allprojects {
repositories {
google()
mavenCentral()
}


}

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"


}
subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
My app level build.gradle file

plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id("com.google.gms.google-services")

}

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 "sanjishk99.com.contacts_app"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
//ext.kotlin_version = '1.9.20'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "sanjishk99.com.contacts_app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21 //flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}




}




flutter {
source '../..'
}

dependencies {

// Import the Firebase BoM
implementation(platform("com.google.firebase:firebase-bom:32.8.0"))


// TODO: Add the dependencies for Firebase products you want to use
// When using the BoM, don't specify versions in Firebase dependencies
implementation("com.google.firebase:firebase-analytics")


// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries


}

Please help

regards

Sanjish



My
 

B. Diddy

Senior Ambassador
Moderator
Mar 9, 2012
165,618
4,760
113
Visit site
Welcome to Android Central! I moved this to the Software Development forum for more specific traffic.
 

Forum statistics

Threads
943,212
Messages
6,917,843
Members
3,158,883
Latest member
Abdul Ali