Недавно я обновился до версии flutter 3.19, в результате чего меня попросили изменить градиент на использование плагина dsl[https://docs.flutter.dev/release/breaki ... ugin-apply]. Однако я пытаюсь добавить в свой проект пакет flutter_local_notifications, в котором указано, что необходимо внести изменения в файл build.gradles. Я предлагаю добавить «com.android.tools», как указано в документации, следующим образом:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
}
Мои файлы Gradle:
Settings.gradle:
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id 'com.android.tools' version "7.3.1" apply false
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id 'com.google.gms.google-services' version "4.3.15" apply false
}
include ":app"
android/build.gradle:
ext {
compileSdkVersion = 34 // or higher / as desired
targetSdkVersion = 33 // or higher / as desired
minSdkVersion = 21 // Required minimum
appCompatVersion = "1.4.2" // or higher / as desired
playServicesLocationVersion = "21.0.1" // or higher / as desired
}
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
}
android/app/build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id 'com.android.tools'
}
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 {
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
}
}
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
shrinkResources false
}
}
}
flutter {
source '../..'
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
implementation 'io.radar:sdk:3.8.+'
implementation 'com.facebook.android:facebook-android-sdk:latest.release'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
}
Однако упомянутые шаги соответствуют старой системе Gradle. У меня возникла проблема с добавлением плагина. Однако я попробовал внести изменения по методу плагина dsl. Я получаю сообщение об ошибке:
FAILURE: Build failed with an exception.
* Where:
Settings file '/StudioProjects/project/android/settings.gradle' line: 33
* What went wrong:
Plugin [id: 'com.android.tools', version: '7.3.1', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.tools:com.android.tools.gradle.plugin:7.3.1')
Searched in the following repositories:
Google
MavenRepo
Gradle Central Plugin Repository
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Error: Gradle task assembleDebug failed with exit code 1
Источник: https://stackoverflow.com/questions/781 ... -dsl-grade
Проблемы с добавлением пакетов после перехода на версию плагина DSL. ⇐ Android
Форум для тех, кто программирует под Android
1710413564
Гость
Недавно я обновился до версии flutter 3.19, в результате чего меня попросили изменить градиент на использование плагина dsl[https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply]. Однако я пытаюсь добавить в свой проект пакет flutter_local_notifications, в котором указано, что необходимо внести изменения в файл build.gradles. Я предлагаю добавить «com.android.tools», как указано в документации, следующим образом:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
}
Мои файлы Gradle:
Settings.gradle:
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id 'com.android.tools' version "7.3.1" apply false
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
id 'com.google.gms.google-services' version "4.3.15" apply false
}
include ":app"
android/build.gradle:
ext {
compileSdkVersion = 34 // or higher / as desired
targetSdkVersion = 33 // or higher / as desired
minSdkVersion = 21 // Required minimum
appCompatVersion = "1.4.2" // or higher / as desired
playServicesLocationVersion = "21.0.1" // or higher / as desired
}
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
}
android/app/build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id 'com.android.tools'
}
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 {
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
}
}
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
shrinkResources false
}
}
}
flutter {
source '../..'
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'
implementation 'io.radar:sdk:3.8.+'
implementation 'com.facebook.android:facebook-android-sdk:latest.release'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
}
Однако упомянутые шаги соответствуют старой системе Gradle. У меня возникла проблема с добавлением плагина. Однако я попробовал внести изменения по методу плагина dsl. Я получаю сообщение об ошибке:
FAILURE: Build failed with an exception.
* Where:
Settings file '/StudioProjects/project/android/settings.gradle' line: 33
* What went wrong:
Plugin [id: 'com.android.tools', version: '7.3.1', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.tools:com.android.tools.gradle.plugin:7.3.1')
Searched in the following repositories:
MavenRepo
Gradle Central Plugin Repository
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Error: Gradle task assembleDebug failed with exit code 1
Источник: [url]https://stackoverflow.com/questions/78159948/issues-with-adding-packages-after-migration-to-plugin-dsl-grade[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия