У меня возникает повторяющаяся ошибка класса при использовании Mapbox SDK.Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 У меня возникает повторяющаяся ошибка класса при использовании Mapbox SDK.

Сообщение Anonymous »

У меня есть повторяющаяся ошибка класса, которую я не могу исправить. Я пытался уже несколько дней и не могу найти решение. Я использую MapboxSDK и пытаюсь реализовать новейшую версию ('com.mapbox.maps:android:11.7.1'), и моя ошибка следующая:
Дубликат класса com.mapbox.android.core.permissions.PermissionsListener найден в модулях common-24.7.1.aar -> jetified-common-24.7.1-runtime (com.mapbox.common:common:24.7.1) и mapbox-android-core-1.4.1.aar -> jetified-mapbox-android-core-1.4.1-runtime (com.mapbox.mapboxsdk:mapbox-android -core:1.4.1)
Обнаружен повторяющийся класс com.mapbox.android.core.permissions.PermissionsManager
в модулях common-24.7.1.aar -> jetified-common-24.7.1-runtime
(com.mapbox.common:common:24.7.1) и mapbox-android-core-1.4.1.aar - >
jetified-mapbox-android-core-1.4.1-runtime
(com.mapbox.mapboxsdk:mapbox-android-core:1.4.1)

Я также пытался исключить com.mapbox.common или mapbox-android-core, и после исключения любого из них я получил следующую ошибку, указывающую на отсутствие классов, вероятно, из-за исключения:
FATAL EXCEPTION: main
Process: com.b.project, PID: 5138
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.ClassNotFoundException: com.mapbox.maps.loader.MapboxMapsInitializer
at android.app.ActivityThread.installProvider(ActivityThread.java:8291)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7801)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7482)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2415)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8699)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Caused by: androidx.startup.StartupException: java.lang.ClassNotFoundException: com.mapbox.maps.loader.MapboxMapsInitializer
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:242)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2644)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2613)
at android.app.ActivityThread.installProvider(ActivityThread.java:8286)
... 11 more
Caused by: java.lang.ClassNotFoundException: com.mapbox.maps.loader.MapboxMapsInitializer
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:607)
at java.lang.Class.forName(Class.java:512)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:224)
... 16 more
Caused by: java.lang.ClassNotFoundException: com.mapbox.maps.loader.MapboxMapsInitializer
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:1276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:621)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
... 20 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapbox/common/BaseMapboxInitializer;
... 20 more
2024-11-07 22:36:19.387 5138-5138 AndroidRuntime E Cause by: java.lang.ClassNotFoundException: Didn't find class "com.mapbox.common.BaseMapboxInitializer"

Если вам нужна дополнительная информация, дайте мне знать. Надеюсь, у кого-нибудь есть идеи, как это исправить.
Изменить:
Это build.gradle уровня моего приложения. .файл
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android {
compileSdk 34
defaultConfig {
multiDexEnabled true
applicationId "com.corp.testmapboxapp"
minSdkVersion 26
targetSdkVersion 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.testY.runner.AndroidJUnitRunner"

vectorDrawables {
useSupportLibrary = true
}
vectorDrawables.useSupportLibrary = true
}

buildFeatures {
viewBinding = true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
namespace 'com.corp.testmapboxapp'
buildFeatures {
buildConfig true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':core')
implementation project(':chat')

// Android Libs and UI
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'androidx.vectordrawable:vectordrawable:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.8.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.8.3'

// Mapbox dependencies
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:5.0.0'
// Look for mapbox sdk in core
// implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.0.0'
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-turf:5.0.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-building-v7:0.5.0'
// implementation dependenciesList.mapboxServices

// Mapbox plugins
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-places-v9:0.10.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-cluster-utils:0.1.0'
// implementation dependenciesList.mapboxPluginBuilding
// implementation dependenciesList.mapboxPluginPlaces
// implementation dependenciesList.mapboxPluginLocalization
// implementation dependenciesList.mapboxPluginTraffic
// implementation dependenciesList.mapboxPluginMarkerView
// implementation dependenciesList.mapboxPluginAnnotation
// implementation dependenciesList.mapboxPluginScalebar

// Timeline
implementation 'com.github.vipulasri:timelineview:1.1.5'

// Floating action menu / Floating action buttons
implementation 'com.github.clans:fab:1.6.4'

// Facebook API
implementation 'com.facebook.android:facebook-login:5.15.3'

// Google API OAuth
implementation "androidx.credentials:credentials:1.3.0"
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"

// SMS API
implementation 'com.google.android.gms:play-services-auth:21.2.0'
implementation 'com.google.android.gms:play-services-auth-api-phone:18.1.0'

// Google Places API
implementation 'com.google.android.libraries.places:places:4.0.0'
implementation 'androidx.credentials:credentials:1.3.0'
implementation 'com.google.android.libraries.identity.googleid:googleid:1.1.1'
// Google Maps API
// implementation 'com.google.maps.android:android-maps-utils:0.5'
// implementation 'com.google.android.gms:play-services-maps:17.0.1'

// Testing
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.6.1'
androidTestImplementation 'com.android.support.test:rules:1.2.0'
// androidTestImplementation 'org.mockito:mockito-core:2.25.0'
// androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:2.25.0'
// androidTestImplementation 'androidx.test:runner:1.2.0'

// GSON
implementation 'com.google.code.gson:gson:2.10.1'

// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:converter-gson:2.7.1'

// Kotlin dependencies
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

// socket.io dependencies
// implementation 'com.github.nkzawa:socket.io-client:0.6.0'

// Bug handler
implementation 'cat.ereza:customactivityoncrash:2.2.0'

// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'jp.wasabeef:picasso-transformations:2.4.0'

// Calendar
// Calendar added in core, look there
// implementation 'com.github.kizitonwose:CalendarView:0.3.2'
implementation 'androidx.core:core-ktx:1.13.1'

// Emoji
implementation 'com.vanniktech:emoji-google:0.6.0'

// Multidex for too many methods in file
implementation 'com.android.support:multidex:1.0.3'

// Dagger 2
api 'com.google.dagger:dagger:2.28.3'
kapt 'com.google.dagger:dagger-compiler:2.20'
}

repositories {
mavenCentral()
jcenter {}
}


Подробнее здесь: https://stackoverflow.com/questions/791 ... mapbox-sdk
Ответить

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

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

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

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

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