不同的口味未在同一Android设备上安装 [英] Different flavor are not installing on same android device

本文介绍了不同的口味未在同一Android设备上安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在android 5.0中安装多种版本的android应用程序,但是设备仅使我只能安装一种版本.我在android 5.0及更高版本中遇到此问题.

I am trying to install multiple flavors of android applications in android 5.0, but device only enables me to install only one flavor. I am getting this issue in android 5.0 and higher versions.

app/build.gradle:

app/build.gradle :

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    useLibrary 'org.apache.http.legacy'

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
    }

    defaultConfig {
        applicationId "com.app.iqvis.nvolv"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 2
        versionName "2.1"
        multiDexEnabled true
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true


        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"

        }


    }

    productFlavors {
        NVOLV {
            applicationId "com.app.iqvis.nvolv"
            copy {
                from 'src/main/'
                include '*.json'
                into '.'
            }
            versionCode 55
            versionName "2.0.7"
        }
        ISNA {
            applicationId "com.app.iqvis.isna"
//            manifest.srcFile "isna/AndroidMenifest.xml"
        }
        ARNOVA {
            applicationId "com.app.iqvis.arnova"
        }
        PERISCOPE {
            applicationId "com.app.iqvis.periscope"
        }
        SAN {
            applicationId "com.app.iqvis.sanjosejazz"
        }
        OHIO {
            applicationId 'com.app.iqvis.ohioaeyc'
            copy {
                from 'src/OHIO/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.992'
        }
        BeckersHealthCare {
            applicationId 'com.app.iqvis.beckershealthcare'
            copy {
                from 'src/BeckersHealthCare/'
                include '*.json'
                into '.'
            }
            versionCode 33
            versionName '1.92'
        }
        NPCenter {
            applicationId 'com.app.iqvis.npcenter'
            copy {
                from 'src/NPCenter/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName '1.7'
        }
        NVOLVDev {
            applicationId "com.app.iqvis.nvolvdev"

            copy {
                from 'src/NVOLVDev/'
                include '*.json'
                into '.'
            }

            versionCode 20
            versionName "2.40"
        }
        NVOLVDev2 {
            applicationId "com.app.iqvis.nvolvdev2"

            copy {
                from 'src/NVOLVDev2/'
                include '*.json'
                into '.'
            }
            versionCode 1
            versionName "2.0.1"
        }
        WSCPA {
            applicationId "com.app.iqvis.wscpa"
            copy {
                from 'src/WSCPA/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName "1.2"
        }
        UMAA {
            applicationId "com.app.iqvis.umaa"
            copy {
                from 'src/UMAA/'
                include '*.json'
                into '.'
            }
            versionCode 32
            versionName "1.1"
        }
        SFDW {
            applicationId "com.app.iqvis.sfdw"
            copy {
                from 'src/SFDW/'
                include '*.json'
                into '.'
            }

            versionCode 3
            versionName "1.96"

        }
        CALCPA {
            applicationId 'com.app.iqvis.calcpa'
            copy {
                from 'src/CALCPA/'
                include '*.json'
                into '.'
            }
            versionCode 6
            versionName '2.0.4'
        }

    }

    buildTypes {

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

        debug {
            applicationIdSuffix ".debug"
        }

        /**
         * The 'initWith' property allows you to copy configurations from other build types,
         * so you don't have to configure one from the beginning. You can then configure
         * just the settings you want to change. The following line initializes
         * 'jnidebug' using the debug build type, and changes only the
         * applicationIdSuffix and versionNameSuffix settings.
         */

        jnidebug {

            // This copies the debuggable attribute and debug signing configurations.
            initWith debug

            applicationIdSuffix ".jnidebug"
            jniDebuggable true
        }
    }

    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

repositories {
    maven { url 'http://repo1.maven.org/maven2' }
    mavenCentral()
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile files('libs/zbar.jar')
    compile files('libs/android-volley-master-1.0.15.jar')
    compile files('libs/Branch-1.10.8.jar')
    //    compile files('libs/ormlite-core-4.41.jar')
    compile files('libs/sugar-1.3.jar')
    compile files('libs/google-api-client-1.17.0-rc.jar')
    //    compile files('libs/sinch-android-rtc-3.6.1.jar')
    compile files('libs/google-api-services-urlshortener-v1-rev22-1.17.0-rc.jar')
    compile files('libs/crittercism_v5_3_3_sdkonly.jar')
    //    compile files('libs/httpmime-4.1.3.jar')
    compile files('libs/google-http-client-1.17.0-rc.jar')
    //    compile files('libs/ormlite-android-4.41.jar')
    compile files('libs/nvolvlib.jar')
    compile files('libs/myjson-2.3.1.jar')
    compile files('libs/google-http-client-android-1.17.0-rc.jar')
    compile files('libs/iqvisanalytics.jar')
    compile files('libs/stickygridheaders.jar')
    compile files('libs/google-api-client-android-1.17.0-rc.jar')
    //    compile files('libs/commSinch.jar')
    compile project(':resideMenu')
    compile project(':library')
    compile project(':extensiblepageindicator')
    compile project(':ahbottomnavigation')
    compile project(':commSinch')
    compile project(':fab')
    compile files('libs/gentlyWEB-utils-1.1.jar')
    compile files('libs/JoSQL-2.2.jar')
    compile 'joda-time:joda-time:2.7'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'me.leolin:ShortcutBadger:1.1.3@aar'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.13.1'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.google.android.gms:play-services-identity:8.4.0'

    compile 'com.android.support:recyclerview-v7:23.2.1'
    compile 'com.android.support:cardview-v7:23.1.1'

//    compile 'com.android.support:recyclerview-v7:23.0.0'
//    compile 'com.android.support:cardview-v7:23.0.0'

    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'com.roughike:bottom-bar:1.2.1'
    compile 'com.google.guava:guava:19.0'
    compile 'com.ms-square:expandableTextView:0.1.4'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'io.reactivex:rxandroid:1.1.0'
    compile 'io.reactivex:rxjava:1.1.0'
}

任何帮助将不胜感激.预先感谢.

Any kind of help would be highly appreciated. Thanks in advance.

推荐答案

尝试以下解决方案

  1. 检查manifest.xml中是否有任何内容提供者.

例如:

<provider
            android:name="com.facebook.FacebookContentProvider"
            android:authorities="com.facebook.app.FacebookContentProvider1234567890"
            android:exported="true" />

如果存在,您可以尝试以下步骤.

if exists you can try below step.

  1. 在app build.gradle文件中为每种口味和不同的内容提供者使用不同的包名称.

  1. Use different package names for each flavors and different content providers in app build.gradle file.

productFlavors {

flavor1 {
    minSdkVersion 17
    applicationId 'com.app.flavor1'
    signingConfig signingConfigs.config1
    targetSdkVersion 25
    versionCode 8
    versionName '1.4'
    versionNameSuffix 'flavor1'
    manifestPlaceholders = [ api_key_crashlytics:"xxxxxxxxxxxxx", fb_provider:"com.facebook.app.FacebookContentProvider1234567890"]
}
flavor2 {
    minSdkVersion 17
    applicationId 'com.app.flavor2'
    signingConfig signingConfigs.config2
    targetSdkVersion 25
    versionCode 8
    versionName '1.4'
    versionNameSuffix 'flavor2'
    manifestPlaceholders =[api_key_crashlytics:"xxxxxxxxxxxxxy", fb_provider:"com.facebook.app.FacebookContentProvider1234567891"]
}}

,并且在清单中,您可以引用如下所示的值.

and in manifest you can refer values like below.

<provider
        android:name="com.facebook.FacebookContentProvider"
        android:authorities="${fb_provider}"
        android:exported="true" />

这篇关于不同的口味未在同一Android设备上安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆