🐙

【Android】Error running 'app': Cannot debug application の対処法

2021/08/11に公開

概要

Build Variants を release モードで実行すると、以下のエラーが発生しました。

Error running 'app': Cannot debug application from module [application name].app on device [device name]. 
This application does not have the debuggable attribute enabled in its manifest. 
If you have manually set it in the manifest, then remove it and let the IDE automatically assign it. 
If you are using Gradle, make sure that your current variant is debuggable.

対処法

app/build.gradlereleasedebuggable true[1] を追加します。

app/build.gradle

android {
    buildTypes {
        release {
            // 以下を追加
            debuggable true
        }
    }
}
脚注
  1. debuggableはデフォルトでfalseになっている ↩︎

Discussion