Тогда , какие статьи мне следует прочитать, чтобы понять правильную настройку build.gradle.
Что я хочу понять, так это то, что если я создаю apk или appbundle, я могу сказать, что моя сборка находится в правильном состоянии (например, build.gradle правильно использует SDK, sourceCompatibility, targetCompatibility и т. д.).
Кто-нибудь может проверить инфраструктуру моего мобильного проекта?
Это мои результаты flutter Doctor -v:
Код: Выделить всё
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [Version 10.0.26100.2161], locale en-US)
• Flutter version 3.24.1 on channel stable at C:\Users\alagu\FlutterSDK\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5874a72aa4 (3 months ago), 2024-08-20 16:46:00 -0500
• Engine revision c9b9d5780d
• Dart version 3.5.1
• DevTools version 2.37.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\alagu\AppData\Local\Android\Sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_SDK_ROOT = C:\Users\alagu\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.10.2)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Enterprise
• Visual Studio Enterprise 2022 version 17.10.35004.147
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2022.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
[√] Android Studio (version 2024.1)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
[√] VS Code (version 1.95.1)
• VS Code at C:\Users\alagu\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.100.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26100.2161]
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.93
• Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.68
! Device IP_ADDRESS:PORT(IT IS JUST AN ILLUSTRATION) is not authorized.
You might need to check your device for an authorization dialog.
[√] Network resources
• All expected network resources are available.
• No issues found!
Код: Выделить всё
buildscript {
ext.kotlin_version = '1.9.23'//'1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = "../build"
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Код: Выделить всё
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
namespace = "com.rpi.raquelshowroom"
compileSdk = flutter.compileSdkVersion //localProperties.getProperty("flutter.compileSdkVersion").toInteger() //flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion //localProperties.getProperty("flutter.ndkVersion").toInteger() //flutter.ndkVersion
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "RaquelShowroom-${variant.name}-${variant.versionName}.apk"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.rpi.raquelshowroom"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = localProperties.getProperty("flutter.minSdkVersion").toInteger() //flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion //localProperties.getProperty("flutter.targetSdkVersion").toInteger() //flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
multiDexEnabled true
}
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
}
}
}
flutter {
source = "../.."
}
Ребята, у вас есть какие-нибудь идеи? и я был бы очень признателен.
Подробнее здесь: https://stackoverflow.com/questions/791 ... le-and-sou