Created
May 25, 2021 19:47
-
-
Save marcos-bah/66f7880dc4397bcb7c0360777e8675a9 to your computer and use it in GitHub Desktop.
Tutorial de Assinatura de APP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | |
} | |
def keystoreProperties = new Properties() | |
def keystorePropertiesFile = rootProject.file('key.properties') | |
if (keystorePropertiesFile.exists()) { | |
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) | |
} | |
// Estou usando o arquivo key.properties para conter a versão do aplicativo a ser criado | |
def flutterVersionCode = keystoreProperties['versionCode'] | |
if (flutterVersionCode == null) { | |
flutterVersionCode = '1' | |
} | |
def flutterVersionName = keystoreProperties['versionName'] | |
if (flutterVersionName == null) { | |
flutterVersionName = '1.0.0' | |
} | |
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'com.google.gms.google-services' | |
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | |
android { | |
compileSdkVersion 30 | |
sourceSets { | |
main.java.srcDirs += 'src/main/kotlin' | |
} | |
defaultConfig { | |
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | |
applicationId "br.com.seu_app" | |
minSdkVersion 21 | |
targetSdkVersion 30 | |
multiDexEnabled true | |
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.release | |
} | |
debug { | |
signingConfig signingConfigs.release | |
} | |
} | |
} | |
flutter { | |
source '../..' | |
} | |
dependencies { | |
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |
implementation platform('com.google.firebase:firebase-bom:26.6.0') | |
implementation 'com.google.firebase:firebase-analytics-ktx' | |
implementation 'com.google.android.gms:play-services-basement:17.5.0' | |
} | |
apply plugin: 'com.google.gms.google-services' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment