QuickAnswer
by

Android app works locally, but not when published to the store

Android app works locally, but not when published to the store

In Android application development, it works in simulator and actual device test with USB connection, but it does not work when published to the store.
The error message is as follows.

can't play this video

Operating environment

Android studio 4.2.1

build.gradle(Project)

buildscript {
    ext.kotlin_version = "1.5.10"
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle(Module)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "example"
        minSdkVersion 21
        targetSdkVersion 30
        multiDexEnabled true
        versionCode 1
        versionName "1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.5.0'
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.gms:play-services-ads:20.2.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

cause

It seems that the included mp4 files are being compressed during the build process.

The file size of app-release.aab has become unusually small.

Don't let the video be compressed.

Video
app/src/main/res/raw/example.mp4

Put keep.xml in the same folder.

keep.xml

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
    tools:keep="@raw/example"
    />

Extensions are not described.

Another idea

I tried the following, but did not get the results I expected. It may have been some bad combination.

Change the description of build.gradle(Module)

minifyEnabled false

Described in proguard-rules.pro

-keep class android.support.v4.media.** {*;}
CONTENTS
Web Browser