[英]Manifest Merger Failed when importing my aar library into project
Iam是開發android庫的新手。最近需要將我的應用程序的某些部分集成到其他客戶端應用程序。 為此,我已經通過sonatype將aar格式的庫上傳到了Maven倉庫。
但是當我將此庫集成到其他應用程序時出現了問題。我遇到了一些錯誤-
錯誤:將字節碼轉換為dex時出錯:原因:com.android.dex.DexException:多個dex文件定義了Lcom / android / volley / Response $ ErrorListener;
還有更多類似的東西。
我認為到目前為止的問題來自應用程序和庫中定義的多個依賴關系。
我的資料庫中有我做錯的事情嗎,我們如何從應用程序中刪除重復的資料庫。
我嘗試了許多選項,例如“ multidex enable true和preDexLibraries = false”選項,但該屬性均無效。
任何幫助表示贊賞。
我的圖書館應用級別的gradle是:
apply plugin: 'com.android.library'
apply from: 'maven-push.gradle'
android {
compileSdkVersion 26
useLibrary 'org.apache.http.legacy'
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
consumerProguardFiles 'proguard-rules.pro'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
useProguard true
//consumerProguardFiles 'proguard-rules.pro'
buildConfigField "String", "BASEURL", PROD_SERVICE_URL
buildConfigField "String", "MERCHANT_ID", MERCHANT_ID
buildConfigField "String", "ACCESS_CODE", ACCESS_CODE
}
debug {
buildConfigField "String", "BASEURL", STAGING_SERVICE_URL
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.jpardogo.googleprogressbar:library:1.2.0'
implementation 'com.karumi:dexter:4.2.0'
implementation 'com.squareup.okhttp:okhttp:2.4.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'org.jsoup:jsoup:1.7.3'
implementation 'com.mcxiaoke.volley:library:1.0.17'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
//implementation 'com.google.android.gms:play-services-base:15.0.1'
//compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:multidex:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
task deleteJar(type: Delete) {
delete 'libs/jars/logmanagementlib.jar'
}
task createJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('libs/jars/')
include('classes.jar')
rename('classes.jar', 'logmanagementlib.jar')
}
createJar.dependsOn(deleteJar, build)
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.