简体   繁体   中英

Not Able To Open APK file in my android device?

I'm not able to install my app on any other android device and the irony is that, the app is working fine in AVD and on my device. I don't know why but everytime I install, it says "Installation Failed" or "App not Installed" ! Thanks in advance for answering the question.

Below is my build.gradle file:-

android {
    compileSdk 30

    defaultConfig {
        applicationId "com.example.sangeetplayer"
        minSdk 21
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.karumi:dexter:6.2.3'
}

You must be installing the debug build of your app on other devices. For installing your app on other devices, you've to build a release build of your app. You would need a key store to sign your apk.

Follow the below steps to generate a signed apk

  • In the menu bar, click Build > Generate Signed Bundle/APK .
  • In the Generate Signed Bundle or APK dialog, select APK and click Next.
  • Below the field for Key store path, click Create new.
  • On the New Key Store window, provide the required information for your Keystore and key
  • Once you complete the form, click OK.
  • Select the build type, click ok

Your release build apk would be in project folder -> release

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM