Yash Mehta
Yash Mehta

Reputation: 41

Flutter Release Apk (App Not Installed ) Error

I am to install the release app build with the release command flutter build apk --release but when I am trying to install that apk it is showing the App not installed. Please help me to solve this issue. Also I had tried to build apk per abi but then also the issue remains. I am using fvm to build the apk and Flutter version 2.2.2.

app/build.gradle

def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'


def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
   keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


android {
    compileSdkVersion 30

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "package_name"
        minSdkVersion 20
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {
        release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {            
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
        sourceCompatibility JavaVersion.VERSION_1_8
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.50"
    implementation platform('com.google.firebase:firebase-bom:26.4.0')
    implementation "androidx.browser:browser:1.3.0"
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-messaging'
}

Also tried to generate new keystore for the apk but same issue.I had tried both signed and unsigned apk.

Upvotes: 4

Views: 6858

Answers (2)

Ahmad zahid
Ahmad zahid

Reputation: 1

In my case, the app was already installed in my phone through Play store(As i am rebuilding/upgrading the app). so i deleted it and then tried to install it again. It worked!

Upvotes: 0

Marcos Cerqueira
Marcos Cerqueira

Reputation: 51

I solved this problem by following the tips on this link (https://docs.testfairy.com/FAQ/App_Not_Installed_Android_10.html) , in my case the first option solved my problem, after uninstalling the app and restarting my phone I played the apk pro device and it worked.

Upvotes: 5

Related Questions