使用签名的APK升级时未安装应用程序

时间:2019-11-15 12:46:32

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

我的签名应用程序版本较旧,我正尝试使用较新版本进行升级,但未安装错误应用程序。我不想重新安装该应用程序,因为许多用户正在实时使用旧版本。我研究了它,发现唯一的区别是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文件相同的所有其他应用程序版本都将升级,但不是此版本。我的发现正确吗?可能还有其他原因吗?请提出可能的解决方案。 仅供参考-较新版本的版本代码比旧版本更多。

1 个答案:

答案 0 :(得分:0)

  

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

从下面的链接检查。

Reference

希望它会对您有所帮助。