簡體   English   中英

使用簽名的 apk 升級時未安裝應用程序

[英]App not installed while upgrading using signed apk

我有一個舊版本的簽名應用程序,我正在嘗試用新版本升級它,但沒有安裝錯誤應用程序。 我不想重新安裝該應用程序,因為很多用戶正在使用舊版本。 我對其進行了調查,發現唯一的區別是 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()
    }
}

應用級 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 將不會被識別為升級

android {
        ...
        versionCode 2 //from 1 to 2
}

只需 go 到設置 --> 應用程序 --> 單擊您的應用程序。 ---> 在操作欄菜單的應用信息頁面中,將有一個名為“為所有用戶卸載”的選項,單擊該選項。 您的應用程序將被完全卸載,現在您可以嘗試安裝新版本,沒有任何問題。 希望對你有幫助

從下面的鏈接檢查。

參考

希望它會幫助你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM