我正在将 Connectycube 源代码添加到我的 Android 项目中,如下所示:Connectycube Android
我按照概述对配置进行了以下更改。
-
构建.gradle 的整个项目
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.3.61' repositories { google() jcenter() maven { url "https://github.com/ConnectyCube/connectycube-android-sdk-releases/raw/master/" } } dependencies { classpath 'com.android.tools.build:gradle:3.5.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() maven { url "https://github.com/ConnectyCube/connectycube-android-sdk-releases/raw/master/" } } } task clean(type: Delete) { delete rootProject.buildDir }
-
应用程序的build.gradle
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 28 defaultConfig { applicationId "com.example.app2" minSdkVersion 26 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard- rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation("com.squareup.okhttp3:okhttp:4.3.1") testImplementation("com.squareup.okhttp3:mockwebserver:4.3.1") implementation 'com.fasterxml.jackson.core:jackson-core:2.10.2' implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.2' implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.2' implementation("ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0") implementation 'com.github.kittinunf.fuel:fuel:2.2.1' //Core package implementation 'com.github.kittinunf.fuel:fuel-android:2.2.1' //Android implementation 'com.github.kittinunf.fuel:fuel-gson:2.2.1' //Fuel Gson implementation 'com.google.code.gson:gson:2.8.6' //Gson implementation "com.connectycube:connectycube-android-sdk-chat:1.8.1" implementation "com.connectycube:connectycube-android-sdk-videochat:1.8.1" implementation "com.connectycube:connectycube-android-sdk-storage:1.8.1" implementation "com.connectycube:connectycube-android-sdk-pushnotifications:1.8.1" testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' }
该项目构建良好。但是,在运行该应用程序时,该应用程序会立即崩溃,我现在收到以下错误,而在此之前还很好:
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.app2-GGFjPULxWAFkxuGr2o1VpA==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.app2-GGFjPULxWAFkxuGr2o1VpA==/lib/x86, /data/app/com.example.app-GGFjPULxWAFkxuGr2o1VpA==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
使用Galaxy Nexus API 27作为模拟器修复了它。显然,Nexus 5x上的API 26无法与之协同工作。