Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No-shrink build no longer solves issue #59

Open
4bSolutionsLLP opened this issue Mar 9, 2021 · 5 comments
Open

No-shrink build no longer solves issue #59

4bSolutionsLLP opened this issue Mar 9, 2021 · 5 comments

Comments

@4bSolutionsLLP
Copy link

In the latest version of Flutter/Android Studio, when building an android release version, the no-shrink workaround no longer works. At runtime, I get PlatformException(connection_failure.... on physical devices. Emulator in debug mode is ok.

Is there any way round this?

@tryecho
Copy link

tryecho commented Mar 30, 2021

had the same problem and only in debug mode works.

@albertoZurini
Copy link

Same issue here...

@Kamoba
Copy link

Kamoba commented Apr 10, 2021

Same here
I finaly solved this by using the second method provided.
You need first to generate keystore if you do not already have one and configure it following this.

So i end up with:

def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}


android {
    compileSdkVersion 30

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.soupe.my_app"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    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
            signingConfig signingConfigs.release

            minifyEnabled true
            useProguard true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

@JhonaCodes
Copy link

Esto funciona para mi, Trabajando desde MacOs, en Android tanto para Release en APK como para Release con appbundle

  • flutter build apk
  • flutter build appbundle
    La opcion de flutter build apk --no-shrink no funciona para mi.

Mi configuracion esta de la siguiente forma:

dependencies:
flutter:
sdk: flutter
ssh: ^0.0.7

environment:
sdk: ">=2.7.0 <3.0.0"

Quizas suene tonto pero igual lo voy a decir, no poner en dev_dependencies quizas aveces se nos van las luces como me paso a mi.

buildTypes {
    release {
        minifyEnabled true
        useProguard true

        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.release
    }
}

y como dice el post en el archivo que debes crear 'proguard-rules.pro'

#Flutter Wrapper
-keep class io.flutter.app.** { ; }
-keep class io.flutter.plugin.
* { ; }
-keep class io.flutter.util.
* { ; }
-keep class io.flutter.view.
* { ; }
-keep class io.flutter.
* { ; }
-keep class io.flutter.plugins.
* { ; }
-keep class com.jcraft.
* { *; }

Luego haz un flutter clean y intentas como dije anteriormente, eso me funciona perfecto, salu2.

@planetlone
Copy link

Same issue here! Both workarounds didnt work! :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants