【问题标题】:App not installed while upgrading using signed apk使用签名的 apk 升级时未安装应用程序
【发布时间】:2019-11-15 12:46:32
【问题描述】:

我有一个旧版本的已签名应用程序,我正在尝试使用新版本升级它,但出现错误应用程序未安装。我不想重新安装该应用程序,因为很多用户正在使用旧版本。我调查了一下,发现唯一的区别是 Gradle 文件。

旧版本 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

较新版本的 build.gradle

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}

allprojects {
    repositories {
        maven { url "https://maven.google.com" }
        jcenter()
        google()
    }
}

App 级 build.gradle 文件:-

旧版本:

    buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "in.spoors"
        targetSdkVersion 25
        multiDexEnabled true
        minSdkVersion 14
        ndk {
            abiFilters "armeabi-v7a", "x86", "armeabi"
        }
    }
    flavorDimensions "default"
    productFlavors {
        nd {
            applicationIdSuffix ".effortplus"
            buildConfigField("boolean", "IS_LIVE", "false")
//            resValue("string", "server_base_url", "http://nd.spoors.in/mf6")
//            resValue("string","server_base_url","http://ma.spoors.in:8083/effortPlusUat")
            resValue("string", "authority", "in.spoors.effortplus.provider")
            resValue("string", "file_authority", "in.spoors.effortplus.fileprovider")
            resValue("string", "app_name", "EFFORT Plus")
            resValue("string", "app_folder_name", "EFFORT Plus")
            resValue("string", "backup_app_folder_name", "EFFORT Plus")
            resValue("string", "title_activity_home", "EFFORT Plus")
        }
        live {
            applicationIdSuffix ".effortplus"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://spoors.in/mobile")
            resValue("string", "authority", "in.spoors.effortplus.provider")
            resValue("string", "file_authority", "in.spoors.effortplus.fileprovider")
            resValue("string", "app_name", "EFFORT Plus")
            resValue("string", "app_folder_name", "EFFORT Plus")
            resValue("string", "backup_app_folder_name", "EFFORT Plus")
            resValue("string", "title_activity_home", "EFFORT Plus")
        }
        secure_live {
            applicationIdSuffix ".effort2mfmdm"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }
        mapps_byod {
            applicationIdSuffix ".effort2mfmdm.byod"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.byod.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.byod.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }
        mapps_cod {
            applicationIdSuffix ".effort2mfmdm.cod"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.cod.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.cod.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }
        mapps_cod_uat {
            applicationIdSuffix ".effort2mfmdm.coduat"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.coduat.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.coduat.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }

        mapps_byod_uat {
            applicationIdSuffix ".effort2mfmdm.byoduat"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.byoduat.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.byoduat.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")

        }
    }

    dexOptions {
        jumboMode = true
        javaMaxHeapSize "2g"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

}

dependencies {
    implementation files('libs/CWAC-WakefulIntentService.jar')
    implementation files('libs/antlr-4.5.3-complete.jar')
    implementation files('libs/org.eclipse.paho.android.service-1.0.2.jar')
    implementation files('libs/org.eclipse.paho.client.mqttv3-1.0.2.jar')
    implementation files('libs/commons-lang3-3.4.jar')
    implementation files('libs/edm.jar')
    implementation files('libs/license.jar')
    implementation files('libs/rc.jar')
//    implementation files('libs/PdfViewer.jar')
    implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

    implementation files('libs/97bt-android-library.jar')
    implementation files('libs/97bt-android-library-fp.jar')
    implementation files('libs/AEM_SCRYBE_SEP_2014.jar')
    implementation files('libs/core-3.2.0.jar')
    implementation files('libs/deviceutility.jar')
    implementation files('libs/getprintableimage.jar')
    implementation files('libs/mosambeelib_v1.0.0.042.jar')
    //    implementation files('libs/ProwessSdkV2.3.6.jar')
    implementation files('libs/LeopardProwessSdkV-1.1.9.jar')
    implementation 'com.squareup.okhttp3:okhttp:3.4.1'
    implementation 'com.google.android.gms:play-services-base:8.4.0'
    implementation 'com.google.android.gms:play-services-maps:8.4.0'
    implementation 'com.google.android.gms:play-services-gcm:8.4.0'
    implementation 'com.google.android.gms:play-services-location:8.4.0'
    implementation 'com.google.android.gms:play-services-analytics:8.4.0'
    implementation 'com.google.maps.android:android-maps-utils:0.4.+'
    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.android.support:appcompat-v7:25.3.1'
    implementation 'com.android.support:design:25.3.1'
    implementation 'com.android.support:cardview-v7:25.3.1'
    implementation 'com.android.support:recyclerview-v7:25.3.1'
    implementation 'com.scottyab:rootbeer-lib:0.0.4'
    implementation 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:25.3.1'
    implementation(name: 'ImageOptimizationApi', ext: 'aar')
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
//    implementation files('libs/RootTools-4.2.jar')
    //    implementation files('libs/android-support-v4-1.0.jar')
//    implementation files('libs/commons-codec-1.6.jar')
//    implementation files('libs/commons-io-2.4.jar')
    //    implementation files('libs/commons-lang3-3.1.jar')
//    implementation files('libs/httpclientandroidlib-1.1.1.jar')
//    implementation files('libs/maaS360securehttpconnection.jar')
//    implementation files('libs/maas360analytics.jar')
//    implementation files('libs/maas360clipboard.jar')
//    implementation files('libs/maas360dlpsdk.jar')
//    implementation files('libs/maas360encryptionapi.jar')
//    implementation files('libs/maas360gatewaysdk.jar')
//    implementation files('libs/maas360ipclib.jar')
//    implementation files('libs/maas360logger.jar')
//    implementation files('libs/maas360sdk.jar')
    //    implementation files('libs/maas360sqlcipher.jar')
//    implementation files('libs/maas360utils.jar')
    //    implementation files('libs/sqlcipher.jar')
//    implementation files('libs/gson-2.2.3.jar')

}
repositories {
    flatDir {
        dirs 'libs'
    }
}

新版本:-

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "in.spoors"
        targetSdkVersion 25
        multiDexEnabled true
        minSdkVersion 14
        ndk {
            abiFilters "armeabi-v7a", "x86", "armeabi"
        }
    }
    flavorDimensions "default"
    productFlavors {
        nd {
            applicationIdSuffix ".effortplus"
            buildConfigField("boolean", "IS_LIVE", "false")
//            resValue("string", "server_base_url", "http://nd.spoors.in/mf6")
//            resValue("string","server_base_url","http://ma.spoors.in:8083/effortPlusUat")
            resValue("string", "authority", "in.spoors.effortplus.provider")
            resValue("string", "file_authority", "in.spoors.effortplus.fileprovider")
            resValue("string", "app_name", "EFFORT Plus")
            resValue("string", "app_folder_name", "EFFORT Plus")
            resValue("string", "backup_app_folder_name", "EFFORT Plus")
            resValue("string", "title_activity_home", "EFFORT Plus")
        }
        live {
            applicationIdSuffix ".effortplus"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://spoors.in/mobile")
            resValue("string", "authority", "in.spoors.effortplus.provider")
            resValue("string", "file_authority", "in.spoors.effortplus.fileprovider")
            resValue("string", "app_name", "EFFORT Plus")
            resValue("string", "app_folder_name", "EFFORT Plus")
            resValue("string", "backup_app_folder_name", "EFFORT Plus")
            resValue("string", "title_activity_home", "EFFORT Plus")
        }
        secure_live {
            applicationIdSuffix ".effort2mfmdm"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }
        mapps_byod {
            applicationIdSuffix ".effort2mfmdm.byod"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.byod.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.byod.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }
        mapps_cod {
            applicationIdSuffix ".effort2mfmdm.cod"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.cod.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.cod.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }
        mapps_cod_uat {
            applicationIdSuffix ".effort2mfmdm.coduat"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.coduat.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.coduat.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")
        }

        mapps_byod_uat {
            applicationIdSuffix ".effort2mfmdm.byoduat"
            buildConfigField("boolean", "IS_LIVE", "true")
//            resValue("string", "server_base_url", "https://secure.spoors.in/effort6")
            //resValue("string", "server_base_url", "http://nd.spoors.in:9080/effort5-2016")
//            resValue("string","server_base_url","https://nd.spoors.in/effort5-2016")
            resValue("string", "authority", "in.spoors.effort2mfmdm.byoduat.provider")
            resValue("string", "file_authority", "in.spoors.effort2mfmdm.byoduat.fileprovider")
            resValue("string", "app_name", "EFFORT MAPPS")
            resValue("string", "app_folder_name", "EFFORT MAPPS")
            resValue("string", "backup_app_folder_name", "EFFORT MAPPS")
            resValue("string", "title_activity_home", "EFFORT MAPPS")

        }
    }

    dexOptions {
        jumboMode = true
        javaMaxHeapSize "2g"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

}

dependencies {
    implementation files('libs/CWAC-WakefulIntentService.jar')
    implementation files('libs/antlr-4.5.3-complete.jar')
    implementation files('libs/org.eclipse.paho.android.service-1.0.2.jar')
    implementation files('libs/org.eclipse.paho.client.mqttv3-1.0.2.jar')
    implementation files('libs/commons-lang3-3.4.jar')
    implementation files('libs/edm.jar')
    implementation files('libs/license.jar')
    implementation files('libs/rc.jar')
//    implementation files('libs/PdfViewer.jar')
    implementation('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

    implementation files('libs/97bt-android-library.jar')
    implementation files('libs/97bt-android-library-fp.jar')
    implementation files('libs/AEM_SCRYBE_SEP_2014.jar')
    implementation files('libs/core-3.2.0.jar')
    implementation files('libs/deviceutility.jar')
    implementation files('libs/getprintableimage.jar')
    implementation files('libs/mosambeelib_v1.0.0.042.jar')
    //    implementation files('libs/ProwessSdkV2.3.6.jar')
    implementation files('libs/LeopardProwessSdkV-1.1.9.jar')
    implementation 'com.squareup.okhttp3:okhttp:3.4.1'
    implementation 'com.google.android.gms:play-services-base:8.4.0'
    implementation 'com.google.android.gms:play-services-maps:8.4.0'
    implementation 'com.google.android.gms:play-services-gcm:8.4.0'
    implementation 'com.google.android.gms:play-services-location:8.4.0'
    implementation 'com.google.android.gms:play-services-analytics:8.4.0'
    implementation 'com.google.maps.android:android-maps-utils:0.4.+'
    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.android.support:appcompat-v7:25.3.1'
    implementation 'com.android.support:design:25.3.1'
    implementation 'com.android.support:cardview-v7:25.3.1'
    implementation 'com.android.support:recyclerview-v7:25.3.1'
    implementation 'com.scottyab:rootbeer-lib:0.0.4'
    implementation 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:25.3.1'
    implementation(name: 'ImageOptimizationApi', ext: 'aar')
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
//    implementation files('libs/RootTools-4.2.jar')
    //    implementation files('libs/android-support-v4-1.0.jar')
//    implementation files('libs/commons-codec-1.6.jar')
//    implementation files('libs/commons-io-2.4.jar')
    //    implementation files('libs/commons-lang3-3.1.jar')
//    implementation files('libs/httpclientandroidlib-1.1.1.jar')
//    implementation files('libs/maaS360securehttpconnection.jar')
//    implementation files('libs/maas360analytics.jar')
//    implementation files('libs/maas360clipboard.jar')
//    implementation files('libs/maas360dlpsdk.jar')
//    implementation files('libs/maas360encryptionapi.jar')
//    implementation files('libs/maas360gatewaysdk.jar')
//    implementation files('libs/maas360ipclib.jar')
//    implementation files('libs/maas360logger.jar')
//    implementation files('libs/maas360sdk.jar')
    //    implementation files('libs/maas360sqlcipher.jar')
//    implementation files('libs/maas360utils.jar')
    //    implementation files('libs/sqlcipher.jar')
//    implementation files('libs/gson-2.2.3.jar')

}
repositories {
    flatDir {
        dirs 'libs'
    }
}

所有其他 gradle 文件相同的应用程序版本都在升级,但不是这个。我的发现正确吗?可能还有其他原因吗?请提出可能的解决方案。 仅供参考 - 新版本的版本代码比旧版本更多。

【问题讨论】:

  • 您是否使用相同的密钥库来签署新的 APK?
  • 您确定该应用使用相同的证书签名吗?
  • @PrashantSable 是的
  • @VladyslavMatviienko 是的.. 使用相同的密钥库文件
  • 向我们展示应用级别的 build.gradle 文件。这是项目级别的 build.gradle 文件。

标签: android android-studio gradle android-gradle-plugin build.gradle


【解决方案1】:

只需转到设置 --> 应用程序 --> 单击您的应用程序。 ---> 在应用程序中 操作栏菜单上的信息页面将有一个名为“ 为所有用户卸载“点击它。您的应用程序将完全 已卸载,现在您可以尝试安装新版本 问题。希望对你有帮助

从下面的链接检查。

Reference

希望对你有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-12
    • 2018-08-20
    • 1970-01-01
    相关资源
    最近更新 更多