Cordova: Is it possible to have different app IDs for android and ios platforms?

后端 未结 2 1359
攒了一身酷
攒了一身酷 2020-12-14 16:45

Let\'s say I have a Cordova application with an id of com.StackOverflowExample.MyQuestion, which I created with Cordova 3 using the CLI (cordova create). I have

相关标签:
2条回答
  • 2020-12-14 17:07

    This is now built into CLI (finally):

    In you your config.xml file-

    Example:

    <widget
        android-packageName="com.example.android"
        ios-CFBundleIdentifier="com.example.ios">
    

    Source:

    https://github.com/apache/cordova-lib/blob/master/cordova-common/src/ConfigParser/ConfigParser.js#L99

    0 讨论(0)
  • 2020-12-14 17:18

    Yes, you can do that. There is more option for them, it's depends on how do you build your Android application (how do you create your apk).

    If you create the apk using cordova, first you have to decode your apk:

    apktool d <apkname>.apk <directory to decode>
    e.g: 
    apktool d your.apk decodedir
    

    Change the package="com.StackOverflowExample.MyQuestion" string in AndroidManifest.xml.

    Encode your apk:

    apktool b <directory> <new apk name>
    e.g:
    apktool b testdir/ your.repacked.apk
    

    If you create the apk using any Android developer tools, you can change the id in the appropriate xml file (AndroidManifest.xml), and build the app.

    0 讨论(0)
提交回复
热议问题