【问题标题】:generated signed apk from android studio gives error "there was a problem parsing the package" on installing on device从android studio生成的签名apk在设备上安装时出现错误“解析包时出现问题”
【发布时间】:2021-07-15 10:42:05
【问题描述】:

在通过物理设备在模拟器或设备上进行测试期间,应用运行良好。 但是当我尝试在 android studio 中生成签名的 apk 时,生成的签名应用程序不会安装在真实设备上。它显示错误“解析包时出错”。 我试过了 缩小启用 false/true 我尝试删除 .gradle 和 .idea 尝试了多个键*enter code here 没有任何效果。请帮忙。

我的摇篮

{
plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.reg.nsb"
        minSdkVersion 21
        targetSdkVersion 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.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.firebase:firebase-messaging:22.0.0'
    implementation 'com.google.firebase:firebase-config:21.0.0'
    implementation 'com.google.firebase:firebase-analytics:19.0.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.flaviofaria:kenburnsview:1.0.7'
    implementation 'com.mindorks.android:prdownloader:0.6.0'
    implementation 'com.android.volley:volley:1.1.0'
}
}

【问题讨论】:

    标签: java android apk


    【解决方案1】:

    如果是,请检查设备上是否已安装调试版本,然后删除已安装在设备中的调试版本并再次安装签名的 apk

    希望对你有帮助

    【讨论】:

    • 先生,我的设备上没有安装调试版本。此外,由 android studio 生成的签名 apk 的大小在 1-2 MB 之间非常小
    • 请尝试使用 lintoptions{。 Checkreleasebuilds false abortonerror false} dexoptions,. gradle android{} 中的编译选项等
    • 运气不好。我重新安装了android studio并使用hello word创建了一个新项目,当我生成签名的apk时,该项目也给出了同样的错误
    • 请验证这一点 (1)请在手机设置中检查允许从其他来源安装 (2)检查下载的 .apk 是否完全未下载或损坏 (3)检查应用程序是否与硬件兼容或您正在使用的操作系统的版本。 ....它可以帮助你
    【解决方案2】:

    -嗨,我遇到了类似的错误,问题似乎是targetsdkversion。 我的 targetsdkversion 是 31,它在 android 12 设备上出现解析错误,但它确实安装在我的 android 9 设备上。

    • 从外部源安装时
    • 我将其更改为 29,现在它似乎正在安装在我的 android 12 设备上

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多