【问题标题】:Two flavors of the app on the same device [duplicate]同一设备上的两种应用程序[重复]
【发布时间】:2017-01-31 16:19:59
【问题描述】:

我使用 Google Play 开发者控制台创建了两个独立的应用程序:

  • “MyApp”,ID 为 com.myname.app(适用于 prod 风味)
  • “MyApp Stage”,ID 为 com.myname.appStage(适用于 stage 风格)

我使用 gradle 中的 com.github.triplet.play 任务将这些风格部署到相应的 beta 通道。

当我尝试在同一台设备上安装这两种风格时,Google Play 给了我error: -505。如果我卸载第一个安装的版本,那么我可以成功安装第二个。

我看到in this tutorial,应该够了。

有什么想法吗?

这是我的 gradle 脚本片段:

def getGoogleApiJsonFile() {
    (...)
}
android {
    (...)

    defaultConfig {
        applicationId "com.myname"
        (...)
    }
    buildTypes {
        release {
            (...)
            signingConfig signingConfigs.release
        }
    }
    productFlavors {
        prod {
            applicationIdSuffix '.app'
        }
        stage {
            applicationIdSuffix '.appStage'
        }
        dev {
            applicationIdSuffix '.appDevelop'
            (...)
        }
    }
    play {
        jsonFile = getGoogleApiJsonFile()
        track = 'beta'
    }
    (...)
}

以下是 AndroidManifest.xml 的一些片段:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myname">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <uses-feature android:name="android.hardware.camera"
        android:required="true" />

    <application
        android:name=".App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:networkSecurityConfig="@xml/network_security_config">

        <activity
            android:name=".login.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        (... more activities here ...)
        <provider
            android:authorities="com.myname.fileprovider"
            android:name="android.support.v4.content.FileProvider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_provider_paths"
                />
        </provider>

        (... meta-data for io.fabric.ApiKey here...)

    </application>

</manifest>

【问题讨论】:

    标签: android gradle google-play apk


    【解决方案1】:

    由于您的应用中有内容提供商,因此您需要关注this

    【讨论】:

    • 请在此处提供实际有用的内容,而不是链接。
    猜你喜欢
    • 2019-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多