0

I am trying to build an android apk to share but, when installing I get the "App Not Installed" error message.

I have placed my credentials in the build.gradle file:

android {
    compileSdkVersion 28

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.buddiesDrivers"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }


      buildTypes {
       release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
       }
   }


    signingConfigs {
        release {
                    keyAlias 'key'
           keyPassword 'abc123'
           storeFile file('/Users/test/key.jks')
           storePassword 'abc123'
        }
    }

I run the keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key option and ad the creds shown above then:

Flutter clean Flutter Build APK

The build file creates the apk but, it cannot be installed. What did I miss?

  • try answers for this question - https://stackoverflow.com/questions/4226132/app-not-installed-error-on-android?answertab=votes#tab-top – Mol0ko Mar 24 '21 at 06:54
  • Which Android version are you sing to install the app? Try changing your minSdkVersion to 23. Also check if unknown sources install option is enabled on your Android device @A TrueNovice – Aman khan Roohaani Mar 24 '21 at 07:35

2 Answers2

0

Remove your previous installation, if it was the debug so it won't work usually. Uninstall that first then try installing the release version.

Huthaifa Muayyad
  • 11,321
  • 3
  • 17
  • 49
  • Given that you used the right keys and what you posted in the gradlebuild using "abctest..etc" file was just for privacy purposes. If that doesn't help, set minify and shrink enabled to false and try building again then installing. – Huthaifa Muayyad Mar 24 '21 at 06:50
0

it could be because you have set minsdkversion to a higher version. go to Android/app/build.gradle and change minsdversion to 19 or below. it worked for me after trying all the solutions.