有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java无法在我的安卓设备中打开APK文件?

我无法在任何其他安卓设备上安装我的应用程序,讽刺的是,该应用程序在AVD和我的设备上运行良好。我不知道为什么,但每次我安装,它说“安装失败”或“应用程序未安装”! 提前感谢您回答这个问题

下面是我的build.gradle文件:-

安卓 {
    compileSdk 30

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

        testInstrumentationRunner "安卓x.test.runner.AndroidJUnitRunner"
    }

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

dependencies {

    implementation '安卓x.appcompat:appcompat:1.3.1'
    implementation 'com.google.安卓.material:material:1.4.0'
    implementation '安卓x.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.+'
    安卓TestImplementation '安卓x.test.ext:junit:1.1.3'
    安卓TestImplementation '安卓x.test.espresso:espresso-core:3.4.0'
    implementation 'com.karumi:dexter:6.2.3'
}

共 (1) 个答案

  1. # 1 楼答案

    您必须在其他设备上安装应用程序的调试版本。要在其他设备上安装应用程序,您必须构建应用程序的版本。您需要一个key store来签署您的apk

    按照以下步骤生成已签名的apk

    • 在菜单栏中,单击构建生成签名包/APK
    • 在生成签名包或APK对话框中,选择APK并单击下一步
    • 在密钥存储路径字段下方,单击新建
    • 在“新建密钥库”窗口中,提供密钥库和密钥库所需的信息
    • 完成表单后,单击“确定”
    • 选择生成类型,单击“确定”

    您的发布版本apk将位于项目文件夹->;释放