微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在模拟器上运行安装不成功

如何解决在模拟器上运行安装不成功

我正在更新其他人的代码,当我通过 android studio 运行构建时出现以下错误

Installation did not succeed.
The application Could not be installed: INSTALL_PARSE_Failed_NO_CERTIFICATES

List of apks:
[0] '...\01\app\build\intermediates\extracted_apks\release\out\base-arm64_v8a_2.apk'
[1] '...\app\build\intermediates\extracted_apks\release\out\base-en.apk'
[2] '...\app\build\intermediates\extracted_apks\release\out\base-master_2.apk'
[3] '...\app\build\intermediates\extracted_apks\release\out\base-xxhdpi.apk'
APK signature verification Failed

我已经通过 gradle 运行它,然后在我的手机上安装了 apk 并且它可以工作,但它不能直接在模拟器上工作。 minSdkversion 很好。我改了

更新: 这是我的构建文件

android {
   
         
    compileSdkVersion 30
    buildToolsversion "30.0.2"

    defaultConfig {
        applicationId "com.abc.xyz"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 6
        versionName '1.6'

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        //for one signal app id
        manifestPlaceholders = [onesignal_app_id               : "XXXX",onesignal_google_project_number: "XXXX"]

        multiDexEnabled true
    }

    buildTypes {
        release {

            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'


//            firebaseCrashlytics {
//                nativeSymbolUploadEnabled true
//            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.1.0'
    implementation 'com.google.android.gms:play-services-auth:19.0.0'
    implementation 'com.onesignal:Onesignal:3.+@aar'
    implementation 'com.google.android.gms:play-services-gcm:10.2.1'
    implementation 'com.firebase:firebase-client-android:2.5.2+'
    //  implementation 'com.onesignal.OSNotificationopenResult:3.8.3'
    implementation 'com.google.firebase:firebase-messaging:21.0.1'
    // Realm
   // implementation 'io.realm:realm-android:0.82.1'
    implementation 'com.squareup.retrofit:retrofit:1.9.0'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
// Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:26.4.0')
      
    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-crashlytics:17.3.1'

    // Recommended: Add the Google Analytics SDK.
    implementation 'com.google.firebase:firebase-analytics:18.0.2'

    // Add the Firebase Crashlytics NDK dependency.
    implementation 'com.google.firebase:firebase-crashlytics-ndk:17.3.1'

}
repositories {
    mavenCentral()

}

解决方法

确保在您的签名配置中启用 v2 签名方案:

你应该有

v2SigningEnabled true

对于 signingConfigs 块中的所有口味。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。