用于cordova扩展文件插件的Android应用程序崩溃

时间:2017-10-03 09:24:45

标签: android ionic-framework cordova-plugins apk-expansion-files

我已按照本教程https://iphonedevlog.wordpress.com/2014/12/12/adding-an-android-apk-expansion-file-to-a-cordova-project实施了扩展文件。我使用了扩展文件cordova插件https://github.com/agamemnus/cordova-plugin-xapkreader/tree/cordova-6.5.0

我将该应用程序发布为alpha来玩商店进行测试。应用程序在启动时崩溃,并提供下载通知,如下图所示。

enter image description here

1 个答案:

答案 0 :(得分:0)

我们需要修改一些配置如下:

    ./config.xml

    中的
  1.  <variable name="XAPK_EXPANSION_AUTHORITY" value="PACKAGE_NAME" />
     <variable name="XAPK_PUBLIC_KEY" value="PUBLIC_API_KEY" />
     <variable name="XAPK_PATCH_VERSION" value="-1" />
    
  2. 在./plugins/android.json

    "com.flyingsoftgames.xapkreader": {
        "XAPK_EXPANSION_AUTHORITY": "PACKAGE_NAME",
        "XAPK_PUBLIC_KEY": "PUBLIC_API_KEY",
        "XAPK_PATCH_VERSION": "-1"
    }
    
  3. 在./platforms/android.json

    "res/values/xapkreader.xml": {
            "parents": {
                "/*": [
                    {
                        "xml": "<string name=\"xapk_expansion_authority\">PACKAGE_NAME</string>",
                        "count": 1
                    },
                    {
                        "xml": "<string name=\"xapk_google_play_public_key\">PUBLIC_API_KEY</string>",
                        "count": 1
                    },
                    {
                        "xml": "<integer name=\"xapk_patch_version\">-1</integer>",
                        "count": 1
                    }
                ]
            }
        }
    
  4. 位于./platforms/res/values/xapkreader.xml

     <resources xmlns:android="http://schemas.android.com/apk/res/android">
        <string name="xapk_expansion_authority">PACKAGE_NAME </string>
        <string name="xapk_google_play_public_key">PUBLIC_API_KEY </string>
        <integer name="xapk_patch_version">-1</integer>
     </resources>
    
  5. 注意:不要忘记将PACKAGE_NAME和PUBLIC_API_KEY替换为您的应用程序配置。