Android white labeling

会有一股神秘感。 提交于 2019-12-09 19:44:59

问题


I am working for a company which has this "foo" app on the store, the app is a helper for our hardware which is revelled by resellers. We made sure that the name is as generic as possible - in order for our vendors to be able to market the app as "their app".

However - some re-sellers do want to have their exact name and icon on the app. And they are willing to pay so, I need to make this happen.

Questions:

  1. I understand that I am looking for build variants. But still, how can I modify the apk-package-name , display name is default launcher icon using build variants?
  2. Is this permitted...? I am not "officially" spamming the store, but it feels like I could get banned for doing that exactly.
  3. Code signing - I will upload the APK my self, and I will need to sign using different certificates (whatever it's called on android). Again - this is vague, and I cannot find documentation on this subject.
  4. I also plan on releasing a beta version of my app in this way. I am currently using the standard mechanism, but this means that testers cannot show case the app to customers (as it's not finished or crashing most of the time) [1]

  5. Does the term "white labeling" apply here...?

[1] the joys of working in a small company :)


回答1:


You can do this with build variants as you suspected but also you would likely need Flavors.

Here is an example gradle file that has multiple build types and flavors. You set the ApplicationId (packagename used in Play Store) in the flavor settings.

Set up the signing in each type/flavor. You can add resources, icons, manifests etc that are specific to each flavor. You can even replace whole class files so customer specific code is only included in the apk for the customer you are building for.

  defaultConfig {
    applicationId "uk.co.foo.default"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode = 113
    versionName = "3.2.3"
}

signingConfigs {
    release {
        storeFile file("X:\\Android Projects\\Keystore\\MyKeys.jks")
        storePassword "MyPassword"
        keyAlias "KeyAlias"
        keyPassword "itsasecret"
    }
}

productFlavors {
    Customer1 {
        applicationId "uk.co.foo.customer1"
    }

    Customer2 {
        applicationId "uk.co.foo.customer2"
    }
}

buildTypes {

    debug {
        applicationIdSuffix ".debug"
        versionNameSuffix " Debug"
    }

    beta {
        applicationIdSuffix ".beta"
        versionNameSuffix " Beta"
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }

    signed {
        minifyEnabled false
        debuggable true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }

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

Here is the folder structure for adding resources for each type\flavor. In this example, the second flavor is called "fan". The "main" folder is used by default. Each type and flavors resources are merged into the apk (replacing any of the same name in the main folder) depending on which build you choose in the "Build Variants" section of Android Studio.

Android Studio will display which folders are in effect for the current build as shown highlighted in this image.


Edit - full official documentation is available here: https://developer.android.com/tools/building/configuring-gradle.html



来源:https://stackoverflow.com/questions/35828970/android-white-labeling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!