我已经更新了一个过时的项目,并进行了更改以构建gradle,基本上升级了一些gradle依赖项并更改了gradle版本。当我执行清理和重建后,项目构建成功。但是,当我尝试在设备或仿真器上运行它时,由于transformDexArchiveWithExternalLibsDexMergerForDebug
错误而无法构建。
我已经尝试了这两个SO线程的几乎所有解决方案,但仍然无法使它起作用。
以下是我的项目级别gradle。
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
dependencies {
}
ext {
libraryVersion = "1.0.8"
}
这是应用程序模块gradle。
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.dapp.myapp"
minSdkVersion 16
targetSdkVersion 28
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
lintOptions {
disable 'MissingTranslation'
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':maskedEditText')
implementation project(':aPV')
//implementation files('libs/libGoogleAnalyticsServices.jar')
//compile 'com.android.support:appcompat-v7:19.1.0'
implementation files('libs/simple-xml-2.7.1.jar')
implementation project(':segmentControl')
implementation files('libs/gcm.jar')
implementation project(':UpPlatformSdk')
implementation files('libs/scribe-1.3.7.jar')
implementation files('libs/signpost-commonshttp4-1.2.1.2.jar')
implementation files('libs/signpost-core-1.2.1.2.jar')
// compile 'com.github.PhilJay:MPAndroidChart:v2.1.0'
implementation files('libs/joda-time-2.0.jar')
implementation project(':MPChartLib')
implementation files('libs/apache-httpcomponents-httpclient.jar')
implementation files('libs/apache-httpcomponents-httpcore.jar')
/*compile 'com.google.android.gms:play-services:8.4.0'*/
implementation files('libs/libphonenumber-3.8.jar')
implementation files('libs/ebizcharge-sdk.jar')
//compile project(':slicepaymentlibrary')
//compile project(':camerafragment')
implementation project(':camerafragment')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.loopj.android:android-async-http:1.4.5'
implementation 'com.android.support:customtabs:28.0.0'
//implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
}
完全错误的堆栈跟踪,因为粘贴在此处超出了字符数限制
任何帮助表示赞赏。谢谢。
答案 0 :(得分:0)
更新您的Google Services依赖项:
classpath 'com.google.gms:google-services:3.3.0'
Firebase versioning style has changed,它可能导致库冲突引起的问题。
答案 1 :(得分:0)
尝试使用此项目级别的工具,我在应用中遇到了相同的问题,但这可以解决我的问题
buildscript {
repositories {
maven {
url 'http://jcenter.bintray.com'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'de.mobilej.unmock:UnMockPlugin:0.1.0'
classpath 'org.aspectj:aspectjtools:1.8.9'
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:1.0.10'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5"
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1'
classpath "com.archinamon:android-gradle-aspectj:3.2.0"
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}