Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow installing debug-built app alongside release one #1011

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ android {
"ko", "lt", "nl", "pl", "pt", "pt-BR", "ru", "sk", "sl", "zh-CN"]
buildConfigField "String[]", "SUPPORTED_LOCALES", "new String[]{\""+
supportedLocales.join("\",\"")+"\"}"

// Allow distinguishing between release and debug app when installed
// simultaneously (see below).
manifestPlaceholders = [appLabel: "@string/app_name"]
}

signingConfigs {
Expand Down Expand Up @@ -58,6 +62,12 @@ android {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

debug {
// Allow installing debug version in parallel.
applicationIdSuffix ".debug"
manifestPlaceholders = [appLabel: "Kore (Debug)"]
}
}

buildFeatures {
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

<!-- ${appLabel} comes from build.gradle. -->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="${appLabel}"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config">
Expand Down Expand Up @@ -184,9 +185,13 @@
<activity android:name=".ui.sections.favourites.FavouritesActivity" />

<!-- Providers -->
<!-- ${applicationId} will be different between release & debug build.
This allow the release & debug builds to be co-installable.
See https://stackoverflow.com/a/58329725/9161044
-->
<provider
android:name=".provider.MediaProvider"
android:authorities="org.xbmc.kore.provider"
android:authorities="${applicationId}.provider"
android:exported="false" />

<!-- Services -->
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/org/xbmc/kore/provider/MediaContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
import android.net.Uri;
import android.provider.BaseColumns;

import org.xbmc.kore.BuildConfig;

/**
* Contract class for interacting with {@link MediaProvider}.
*/
public class MediaContract {

public static final String CONTENT_AUTHORITY = "org.xbmc.kore.provider";
public static final String CONTENT_AUTHORITY = BuildConfig.APPLICATION_ID + ".provider";

public static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

Expand Down