Сборка была настроена так, чтобы предпочитать репозитории настроек репозиториям проектов, но репозиторий «Gradle Libs»Android

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Сборка была настроена так, чтобы предпочитать репозитории настроек репозиториям проектов, но репозиторий «Gradle Libs»

Сообщение Anonymous »

У меня есть существующий проект Flutter, и на данный момент я решил несколько проблем. Однако возникла новая проблема:

Сборка была настроена так, чтобы предпочитать репозитории настроек репозиториям проекта
, но репозиторий «Gradle Libs» был добавлен в настройках. file
'settings.gradle'

Эта ошибка возникает, когда я открываю проект в Android Studio. Интересно, что когда я запускаю проект из Visual Studio Code, ошибка не появляется, и я могу без проблем запустить проект на эмуляторе.
build.gradle (Проект: Android)

Код: Выделить всё

// buildscript {
//     ext.kotlin_version = '1.8.0'
//     repositories {
//         google()
//         jcenter()
//                 mavenCentral() // Add this repository

//     }

//     dependencies {
//         classpath 'com.android.tools.build:gradle:7.1.3'
//         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

//         // Add the google services classpath
//         classpath 'com.google.gms:google-services:4.3.10'

// //
// //        // Add the Flutter plugin classpath
// //        classpath 'dev.flutter:flutter-gradle-plugin:1.0.0' // Add this line
//     }
// }

allprojects {
repositories {
google()
jcenter()
mavenCentral() // Add this repository

}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
build.gradle(project.app)

Код: Выделить всё

plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin" // Ensure this line is correct
}

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 flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

// apply plugin: 'com.android.application'
// apply plugin: 'kotlin-android'
// apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// apply plugin: 'com.google.gms.google-services'

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
compileSdkVersion 33

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 "com.mbi.MyAduanApp"
minSdkVersion 30
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

signingConfigs{
release{
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
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
}
}
lint {
disable 'InvalidPackage'
}
}

//flutter {
//    source '../..'
//}

dependencies {
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.20"

implementation 'com.google.firebase:firebase-messaging:21.0.1'
implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.0'

}
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 "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.2.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.20" apply false
}

include ":app"
Я не уверен, какую ошибку я совершил. Буду очень признателен за любую помощь в решении этой проблемы.
Заранее спасибо!

Подробнее здесь: https://stackoverflow.com/questions/786 ... sitories-b
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»