Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch from Release mode to Debug mode

I have recently built a release version to test on the Android Play Store. The problem is I can't get it back to Debug mode. When I try to launch in Debug mode this is the message I get on the console:

Launching lib\main.dart on SM P585 in release mode...
Running Gradle task 'assembleRelease'..

This is what my build.gradle file looks like:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 29

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.my_app"
        minSdkVersion 18
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

dependencies {
    implementation 'com.android.support:multidex:1.0.3' //enter the latest version
}
android {
    defaultConfig {
        multiDexEnabled true
    }
}

However, the local.properties tells me that Flutter is still in release mode:

sdk.dir=C:/Users/USER/AppData/Local/Android/Sdk
flutter.sdk=C:\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1

How can I switch from release mode back to debug mode?

like image 360
meeth23 Avatar asked Mar 20 '26 05:03

meeth23


1 Answers

In android studio, there is a 'build variants' tab on the vertical side pane, you can change the current config being built, there.

Ensure that the build.gradle contains the build configs first. Else add new configuration by refererring gradle docs or write them by your self, if you know, or pull from a project which contains 'debug' build config.

refer to the attached image.enter image description here

like image 54
mahee96 Avatar answered Mar 23 '26 01:03

mahee96