Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two flavors of the app on the same device [duplicate]

I have created two separate apps using Google Play Developer Console:

  • "MyApp" with ID com.myname.app (for prod flavor)
  • "MyApp Stage" with ID com.myname.appStage (for stage flavor)

I deploy these flavors to the corresponding beta channels using com.github.triplet.play task in gradle.

When I try to install both flavors on the same device, the Google Play gives me error: -505. If I uninstall the first installed version, then I can successfully install the second one.

As I can see in this tutorial, it should be enough.

Any ideas what's wrong?

Here is my gradle script 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'
    }
    (...)
}

And here are some fragments of the 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>
like image 877
Andrzej Zabost Avatar asked Nov 08 '22 02:11

Andrzej Zabost


1 Answers

since you have a content provider in your app, you need to follow this

like image 132
Saurabh Avatar answered Nov 15 '22 08:11

Saurabh