简体   繁体   English

无法在我的 android 设备中打开 APK 文件?

[英]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.我无法在任何其他 Android 设备上安装我的应用程序,具有讽刺意味的是,该应用程序在 AVD 和我的设备上运行良好。 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:-下面是我的build.gradle文件:-

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.您需要一个key store来签署您的 apk。

Follow the below steps to generate a signed apk按照以下步骤生成签名的 apk

  • In the menu bar, click Build > Generate Signed Bundle/APK .在菜单栏中,单击Build > Generate Signed Bundle/APK
  • In the Generate Signed Bundle or APK dialog, select APK and click Next.在 Generate Signed Bundle or APK 对话框中,选择 APK 并单击 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在 New Key Store 窗口中,提供您的 Keystore 和密钥所需的信息
  • Once you complete the form, click OK.完成表单后,单击“确定”。
  • Select the build type, click ok选择构建类型,点击ok

Your release build apk would be in project folder -> release您的发布版本 apk 将位于项目文件夹 -> 发布中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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