<a href= "d.android.com/r/tools/classpath-sync-errors" >修复依赖项解析错误</a>。添加 mapbox_gl 及其 SD



app\builded.gradle

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'
android {
namespace "com.example.movini_app"
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
multiDexEnabled true
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.movini_app"
// 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.
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:31.3.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.mapbox.maps:android:10.12.1'
}

android/build.gradle

ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

,这些都是我遇到的错误注意:C:\Users\Eya\AppData\Local\Pub\Cache\hosted\Pub.dev\cloud_firestore-4.5.0\android\src\main\java\io\flugins\firebase\firestore\FlutterFirebaseFirestoreMessageCodec.java使用未检查或不安全的操作。注意:使用-Xlint重新编译:有关详细信息,请取消选中。注意:某些输入文件使用或覆盖不推荐使用的API。注意:使用-Xlint重新编译:有关详细信息,请弃用。注意:有些输入文件使用未检查或不安全的操作。注意:使用-Xlint重新编译:有关详细信息,请取消选中。

失败:生成失败,出现异常。

  • 出了什么问题:任务":app:checkDebugDuplicateClasses"的执行失败

执行com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable时出错在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0.0)中发现重复的类com.mapbox.android.core.location.LocationEngine在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0.0)中发现重复的类com.mapbox.android.core.location.LocationLocationEngineCallback在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0.0)中发现重复的类com.mapbox.android.core.location.LocationLocationEngineProvider在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0.0)中发现重复的类com.mapbox.android.core.locationLocationEngineRequest在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0)中发现重复的类com.mapbox.LocationEngineRequest$1在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0)中发现重复的类com.mapbox.LocationEngineRequest$Builder在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0.0)中发现重复的类com.mapbox.android.core.locationLocationEngineResult在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0.0)中发现重复的类com.mapbox.android.core.permissions.PermissionsListener在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0)中发现重复的类com.mapbox.android.core.permissions.PermissionsManager在模块jetified-common-23.4.0-runtime(com.mapbox.common:common:23.4.0)和jetified-mapbox-android-core-5.0.0-runtime(com.mapbox.mapboxsdk:mapbox android core:5.0)中发现重复类com.mapbox.android.corepermissions.PermissionsManager$AccuracyAuthorization

Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
  • 尝试:

使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的见解。

我找到了与multiDexing相关的解决方案。

只需转到您的应用程序模块build.gradle并添加

android {
defaultConfig {
...
minSdkVersion 21 
targetSdkVersion flutter.targetSdkVersion
multiDexEnabled true <-- add this line
}
...
}

以及相关性部分:

dependencies {
implementation "androidx.multidex:multidex:2.0.1" <-- add this line too
}

这是指向文档的链接:https://developer.android.com/build/multidex#groovy

相关内容

  • 没有找到相关文章

最新更新