shaqian / flutter_ssh

SSH and SFTP client for Flutter
https://pub.dartlang.org/packages/ssh
MIT License
117 stars 83 forks source link

No-shrink build no longer solves issue #59

Open 4bSolutionsLLP opened 3 years ago

4bSolutionsLLP commented 3 years ago

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 commented 3 years ago

had the same problem and only in debug mode works.

albertoZurini commented 3 years ago

Same issue here...

Kamoba commented 3 years ago

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 commented 3 years ago

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

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 commented 3 years ago

Same issue here! Both workarounds didnt work! :(