android - 应用程序安装失败,构建脚本错误

标签 android gradle build installation apk

在这里,我添加了最新的 google play services(com.google.gms:google-services:3.0.0), gradle(com.android.tools.build:gradle:2.2.0-alpha)。在我的设备中安装时出现以下错误。

enter image description here 这是应用程序 build.gradle 的内容。

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

packagingOptions {
    exclude 'META-INF/NOTICE' // will not include NOTICE file
    exclude 'META-INF/LICENSE' // will not include LICENSE file
    exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.properties'
    exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.xml'
    exclude 'META-INF/maven/com.squareup.okhttp/okhttp/pom.xml'
    exclude 'META-INF/maven/com.squareup.okhttp/okhttp/pom.properties'
}

defaultConfig {
    applicationId "com.wolfmatrix.navz"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}


buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

lintOptions {
    abortOnError false
}

sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }

最佳答案

报错表明apk签名不正确

试试这个-

1) 从 "{WORKSPACE}\{YOUR APP FOLDER}\app\build\outputs\apk" 中删除您签名的 apk。

2) 从设备上卸载您的应用。

3) 通过 USB 调试运行项目以创建 app-debug.apk

4) 成功构建后,您可以签署您的应用程序 apk 以进行发布。

希望对你有帮助:)

更新

检查这个 - Installation failed with Android Studio, APK not signed

关于android - 应用程序安装失败,构建脚本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37875037/

相关文章:

java - Gradle如何添加原生依赖? [Libgdx]

c++ - 使用 Cmake 的 RelWithDebInfo 作为默认构建类型

android - 如何使用 LineageOS 代码库作为起点构建 Android-x86?

c++ - 如何通过 g++-arm-linux-gnueabihf 为 Arm 构建 Qt?

android - 需要 root 在运行时通过应用程序执行 shell 命令 "input keyevent <#>"?

android-studio - 未明确编写脚本的 buildType 的 minifyEnabled 的默认值是什么?

android - 如何处理不同的屏幕尺寸以便 TextView 缩放

java - Gradle 任务在测试后未运行

Android - 如何将 Activity 布局膨胀成 fragment ?

android - WebView 停止使用设备字体设置并使用 HTML 中指定的样式