Search code examples
androidgoogle-playapkandroid-manifest

Google Play: Can't install app, error 504 (INSTALL_PARSE_FAILED_MANIFEST_MALFORMED)


I have an app that was uploaded to Google Play. The problem is: it does not want to install on some devices, for example a Samsung J7. The other thing is that, I have two same devices (Gionee S Plus), one has Android 7.0 rooted, on which the app is working fine, and the other one is on Android 6.0, but the app does not want to install. When I try to install the app on the second device directly with the apk, I get:

Parse error

There was a problem parsing the package

And when I try to install it from the Store, I get:

Can't install the app

With no other clear message. After searching for this problem, I found that I needed to do somethings:

  • Clear Google Play & services data and cache: did not work
  • Restart phone: did not work
  • Uninstall Google Play updates: when trying to install with the old version, I get the same error message but this time I got the error message 504. When I searched for this error, I read that I should completely delete all my google accounts, which I did but still the same problem.

I doubted it was the manifest problem, and I decompiled the apk but it looks fine.

Manifest.xml on Android Studio:

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

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

    <application
        android:name="com.myapp.MainApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:theme="@style/PurpeTheme">
        <meta-data
            android:name="com.onesignal.NotificationOpened.DEFAULT"
            android:value="DISABLE" />

        <activity android:name="com.myapp.ActivitySplash">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.myapp.ActivityHome" />

        <activity android:name="com.myapp.ActivityTrack"/>
        <activity android:name="com.myapp.ActivityEqualizer" />
        <activity android:name="com.myapp.ActivityAboutUs" />
        <activity android:name="com.myapp.ActivitySettings" />

        <service android:name="com.myapp.services.ServicePlayer" />
        <service android:name="com.myapp.services.DownloadService" />

        <activity android:name="com.myapp.ActivityFavorites" />
        <activity android:name="com.myapp.ActivityPrivacyPolicy" />

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="@string/admob_app_id" />

        <meta-data
            android:name="firebase_crashlytics_collection_enabled"
            android:value="${crashlyticsEnabled}" />
    </application>

</manifest>

build.gradle app level

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.objectbox'
apply plugin: 'io.fabric'

android {

    compileSdkVersion 28

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 3
        versionName "1.2"
        multiDexEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.config
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            manifestPlaceholders = [crashlyticsEnabled: true]
        }

        debug {
            manifestPlaceholders = [crashlyticsEnabled: false]
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
    implementation 'com.google.android.material:material:1.1.0-alpha04'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.android.gms:play-services-ads:17.2.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'jp.wasabeef:blurry:2.1.1'
    implementation 'com.sothree.slidinguppanel:library:3.3.0'
    implementation 'com.nabinbhandari.android:permissions:3.5'
    implementation 'com.orhanobut:dialogplus:1.11@aar'
    implementation 'com.diogobernardino:williamchart:2.5.0'
    implementation 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
    implementation 'com.sdsmdg.harjot:croller:1.0.7'
    implementation 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'jp.wasabeef:glide-transformations:3.3.0'
    implementation 'com.codemybrainsout.rating:ratingdialog:1.0.8'
    implementation 'com.github.varunest:sparkbutton:1.0.5'
    implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
    implementation 'com.google.android.gms:play-services-analytics:16.0.8'
    testImplementation 'junit:junit:4.12'

    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'

}

apply plugin: 'com.google.gms.google-services'

Update:

I get INSTALL_PARSE_FAILED_MANIFEST_MALFORMED when trying to install the app from Android Studio to some devices. I found the solution, and it detailed in my answer below.


Solution

  • Actually, the problem was in the package name, apparently some devices and some android versions (Android 6.0) does not accept a capital lettre as the beginning of a package name. And by package name I mean your project file structure, not the application id.

    Here is what I did get when I tried the app with the emulator, and what did help me find the problem:

    enter image description here