我正在尝试在我的项目中同时使用Mozilla的GeckoView库和TokBox的OpenTok库。这些库都实现了WebRTC代码,我认为这会导致以下构建错误:
失败:构建因异常而失败。
- 出了什么问题: 任务':app:transformDexArchiveWithDexMergerForDebug'的执行失败。 com.android.build.api.transform.TransformException:com.android.dex.DexException:多个dex文件定义Lorg / webrtc / ThreadUtils $ 1Result;
我一直试图解决这个问题几个小时,但我没有取得任何进展。像this one这样的线程很有用,但没有提供解决方案。
一些相关文件:
build.gradle项目:
// Top-level build file where you can add configuration options common
to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
//buildToolsVersion "25.0.3"
defaultConfig {
applicationId "blank"
minSdkVersion 17
targetSdkVersion 19
versionCode 1
versionName "Opentok fix"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
compile 'com.android.support:multidex:1.0.3'
//Some more dependencies
compile 'org.mozilla:geckoview-nightly-armeabi-v7a:+'
compile 'com.opentok.android:opentok-android-sdk:2.14.0'
}
repositories {
maven {
url 'https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.latest.mobile.android-api-16-opt/artifacts/public/android/maven'
}
maven {
url 'https://tokbox.bintray.com/maven'
}
}
My Application类扩展了MultiDexApplication:
public class MainApplication extends MultiDexApplication {
//etc
}
运行sh ./gradlew -q app:dependencies
并未向我提供我可以排除的依赖项:
+--- org.mozilla:geckoview-nightly-armeabi-v7a:+ -> 62.0.20180531101443
+--- com.opentok.android:opentok-android-sdk:2.14.0
我真的不知道该怎么办。一位同事即将尝试使用Mozilla存储库来构建没有WebRTC的GeckoView,必须有一种更简单的方法吗?