Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ How to use Android Studio to play more package names APK     - 10 Linux in the passwd command examples (Linux)

- MongoDB data replication and data slices (Database)

- How to manage the time and date at systemd Linux systems (Linux)

- CentOS use wget (Linux)

- How to add a new resolution VirtualBox (Linux)

- The principle Httpclient4.4 (HttpClient Interface) (Programming)

- Log in CentOS 6.5 Multi-user setting VNC (Server)

- Export error: ORA-04063: package body dmsys dbms dm model exp has error (Database)

- BusyBox build root file system (Linux)

- How to Install Focuswriter 1.4.5 (Linux)

- LVM mirrored logical volume to achieve (Linux)

- Install the free open source financial software GnuCash 2.6.6 under Ubuntu (Linux)

- C ++ two second pointer memory model (two-dimensional array) (Programming)

- numpy and SciPy installation under Python for scientific computing package (Linux)

- Depth understanding of DB2 table space (Tablespace) (Database)

- Linux 64-bit porting (Programming)

- Ubuntu 12.04 64-bit installation Redmine + Git + ReviewBoard (Linux)

- Linux Network Programming --epoll model Detailed principles and examples (Programming)

- MYSQL root password for the database user passwords are weak attack analysis (Linux)

- Cacti installation deployment under CentOS 6.6 (Server)

 
         
  How to use Android Studio to play more package names APK
     
  Add Date : 2018-11-21      
         
         
         
  Question: project different distribution channels may need to package a variety of APK (same code), package names may not be the same, if a package name to modify a reprogrammed apk is very troublesome, may refer to the following steps to manipulate the Android Studio Gradle to package different package name apk.

Examples goal here is that the same code, and packaged into com.example.android.newsreader com.example.android.newsreaderdev two different package name apk

1. First, add the following code to the android node build.gradle

productFlavors {
    flavors_release {
        manifestPlaceholders = [str: "releaseStr", package_name: "com.example.android.newsreader"]
        applicationId "com.example.android.newsreader"
    }

    flavors_dev {
        manifestPlaceholders = [str: "devStr", package_name: "com.example.android.newsreaderdev"]
        applicationId "com.example.android.newsreaderdev"
    }
}

This functionality is packaged productFlavors parametric provided, flavors_release and flavors_dev can be regarded as two variable set their own definition, the actual operation can be customized

Noting there is a manifestPlaceholders argument, which is actually provided several parameters variables and values, where the parameter $ {name} can be used in a manner in AndroidManifest.xml. The original is to manifest in AndroidManifest node in the package to a dozen different parameterization to achieve the purpose apk package names, namely:

< Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
      package = "$ {package_name}"
      android: versionCode = "1"
      android: versionName = "1.0">
    < Uses-sdk android: minSdkVersion = "11" android: targetSdkVersion = "14" />
...

The results of Lint Android Studio automatically gave me a hint:

I recommend using Android Studio Description applicationId way to set the parameters of the package name

Ever since, I flavors_release and flavors_dev he also added applicationId settings

Let's see if there are effects

2. This step requires manipulation Gradle panel

At this time we click on How to Android Studio to play more package names APK Android Studio refresh button on the right side panel under gradle, so there is something in the following subsection of the build:

Which are beginning to assemble * option to generate apk, apk generated in build / outputs / apk, and here we can double-click on any one to generate the corresponding apk

3. Check the contents of the following Project panel

Open the project panel, we find that there have been a few really apk:

Gradle can be seen in three apk will generate a double-click every time we put newsreader-flavors_dev-debug.apk and newsreader-flavors_release-debug.apk out to check under their package names with aapt command (command aapt dump badging {filename.apk})

Sure enough, the package name is not the same.

So whether it is possible to install it, here are the two apk installed into the simulator, it really is possible:

You can see the emergence of two NewsReader, in fact, they are exactly the same, just different package names

4. How do you specify the time signature in the package

In Android Studio menu bar to enter the Build-> Generate Signed Apk:

Specify your keystore and click next:

Flavors here will find there are two items that we set in two flavors parameters inside gradle configuration, each selected, click on the apk finish to generate the required

5. There is a question, why modify applicationId to modify the package name it? applicationID and packagename in the end what is the relationship

In fact, package represents the java code package. applicationId represents a unique identification applications. And signed application and other applications together to distinguish different. I think this is why Google market reason to allow the same application of different applicationId.

One last tip: Before After packing out best to publish comprehensive testing to avoid problems.
     
         
         
         
  More:      
 
- Ubuntu root user profiles (Programming)
- Nginx installation configuration Zabbix (Server)
- awk Programming Model (Programming)
- Linux learning portal: CentOS 6.4 system kernel upgrade (Linux)
- JDK comes with tools jinfo (Linux)
- Zend Studio PHP syntax color scheme to export (Linux)
- MongoDB upgrade from 2.4.9 to 2.6.0 and PHP record of mongo extension upgrade from 1.4.5 to 1.5.1 (Database)
- Close and limit unused ports computer server security protection (Linux)
- CentOS6.5 installation Docker (Linux)
- ogg start being given libnnz11.so: can not open shared object file (Database)
- Github Getting Started Basic Course (Linux)
- Linux cron job (Linux)
- CentOS yum source configuration (Linux)
- Use NTFS-3G to mount NTFS partitions under Linux U disk and removable hard disk (Linux)
- About DataGuard three protected mode test (Database)
- Installation Strongswan: on a Linux IPsec-based VPN tool (Linux)
- Ceph performance optimization summary (v0.94) (Server)
- Django how to generate content in non-HTML formats (Programming)
- Linux system boot process detail (Linux)
- Use Docker containers (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.