android - 同一设备上的两种应用程序

标签 android gradle google-play apk

<分区>

我使用 Google Play Developer Console 创建了两个独立的应用:

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

我使用 com.github.triplet.play 将这些风格部署到相应的测试版 channel gradle 中的任务。

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

如我所见in this tutorial ,应该够了。

有什么问题吗?

这是我的 gradle 脚本 fragment :

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 的一些 fragment :

<?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>

最佳答案

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

关于android - 同一设备上的两种应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41962351/

相关文章:

android - 我的应用程序显示为开发人员在 Google Play 上针对 Wear OS 进行了增强。但我已经为 Phones 开发了它。出了什么问题?

react-native - 播放控制台中的 React Native Release 应用程序错误

Android - 将旋转位图绘制到 Canvas 上的特定位置

android - 如何获取 firebase 库,例如firebase-messaging-9.4.0.jar

android - “C:\dev\sdk\android-sdk-essential\build-tools\24.0.1\aapt.exe”使用非零退出值1结束

android - "Could not get resource"Android Studio Gradle同步错误

android - 如何在 Android Studio 的类路径中配置库的顺序?

google-play - 播放商店: Can't install app, (Error code: -103)

android - 在社交网站上上传应用程序内容

Android 12-Material You 主题在模拟器中不起作用