moiz ahmed
moiz ahmed

Reputation: 41

How do I install debug ApK over playstore APK

I have the Playstore application installed on my mobile! I want to debug that mobile application with my debug APK of the same project. Is there any way to debug that application? I don't want to uninstall the existing application for data. Right now I am getting a signature error when I try to install debug APK over Playstore APK.

Upvotes: 2

Views: 1378

Answers (1)

adityakamble49
adityakamble49

Reputation: 2011

In case you need to install both PlayStore apk and your Debug Apk on device you can use build types applicationIdSuffix as below

Add this to your app level build.gradle

android {

    ...

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
        release {
            // Change to true if you want to apply ProGuard minify
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    ...
}

Using this applicationIdSuffix ".debug" when you build debug apk and install it from android studio it will append .debug on your existing package name

for example

  • PlayStore package name : com.example.myapp

  • Debug Package name : com.example.myapp.debug

In this way you can keep both the versions of your apk on device and debug your apk as you want.


Edit 1

If you are using Google Services with google-services.json you may face following errors

  • Error:Execution failed for task ':app:processDebugGoogleServices'. - Solution
  • No matching client found for package name - Solution

This is because of google-services.json need to match the package name and you need to have multiple google-services.json if you want to have multiple app flavors like Debug and Release

So as per Google Documentation

The google-services.json file is generally placed in the app/ directory (at the root of the Android Studio app module). As of version 2.2.0 the plugin supports build type and product flavor specific JSON files. All of the following directory structures are valid:

// dogfood and release are build types.
app/
    google-services.json
    src/dogfood/google-services.json
    src/release/google-services.json
    ...

Upvotes: 1

Related Questions