当我尝试添加admob SDK时,您好,我收到此错误:
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.gms.security.ProviderInstaller
我尝试过
无效的缓存
清洁和重建
使用./gradlew构建--stacktrace --info命令
但没有成功。
这是我每次都能得到的:
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.gms.security.ProviderInstaller
这是我的应用程序可构建的版本:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "ar.rulosoft.mimanganu"
versionCode 92
versionName "1.92"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion 15
}
signingConfigs {
release {
storeFile file("../mimanganu.jks")
storePassword 'mimanganu'
keyAlias 'mimanganu'
keyPassword 'mimanganu'
}
debug {
storeFile file("../mimanganu.jks")
storePassword 'mimanganu'
keyAlias 'mimanganu'
keyPassword 'mimanganu'
}
}
buildTypes {
release {
lintOptions {
disable 'MissingTranslation'
disable 'NewApi' //Avoid problems in Android Studio 2.4 preview 6
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
}
}
compileOptions.encoding = 'UTF-8'
flavorDimensions "builds"
productFlavors {
fdroid {
signingConfig signingConfigs.release
versionNameSuffix '-fdroid'
dimension "builds"
}
github {
signingConfig signingConfigs.release
//removed to maintain updates as now are
dimension "builds"
}
}
}
android.sourceSets {
test {
java.srcDirs += "$projectDir/src/testShare"
}
androidTest {
java.srcDirs += "$projectDir/src/testShare"
}
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.3.1'
}
dependencies {
final ANDROID_SUPPORT = '28.0.0'
implementation "com.android.support:support-v4:$ANDROID_SUPPORT"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:design:$ANDROID_SUPPORT"
implementation "com.android.support:appcompat-v7:$ANDROID_SUPPORT"
implementation "com.android.support:recyclerview-v7:$ANDROID_SUPPORT"
implementation "com.android.support:preference-v7:$ANDROID_SUPPORT"
api project(':imageviewtouchlibrary')
implementation 'rapid.decoder:library:0.3.0'
implementation 'rapid.decoder:jpeg-decoder:0.3.0'
implementation 'rapid.decoder:png-decoder:0.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0' //on 3.10.0 are deprecated some ciphers
implementation 'com.squareup.okio:okio:1.15.0'
implementation 'com.squareup.duktape:duktape-android:1.3.0'/* v 1.2.0 need 4+mb extra*/
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
implementation 'com.evernote:android-job:1.2.5'
githubImplementation 'com.google.android.gms:play-services-base:16.0.1'
// ADDED BY O D I N
implementation 'com.google.android.gms:play-services-ads:17.1.1'
// ADDED BY O D I N
implementation 'ch.acra:acra:4.9.2'
fdroidApi project(':fakegps')
// for device-based testing
androidTestImplementation "com.android.support:support-annotations:$ANDROID_SUPPORT"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'junit:junit:4.12'
// for host-based testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.0-beta-1'
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
}
项目的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.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
// ADDED BY O D I N
maven {
url "https://maven.google.com"
}
// ADDED BY O D I N
maven {
url 'https://github.com/suckgamony/RapidDecoder/raw/master/repository'
}
google()
}
}
在尝试添加SDK之后,我仍然找不到任何解决方案,希望我在这里找到它
答案 0 :(得分:0)
将maven { url 'https://maven.fabric.io/public' }
添加到您的Project build.gradle。像下面。这为我解决了这个问题。
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
}
答案 1 :(得分:0)
添加
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
Android 5.0之前的Multidex支持
dependencies {
def multidex_version = "2.0.1"
implementation 'androidx.multidex:multidex:$multidex_version'
}
答案 2 :(得分:0)
我遇到了类似的错误:com.android.tools.r8.utils.AbortException: Error: Program type already present: [com.some.lib]
。
在将所有依赖项转储到控制台后(通过./gradlew dependencies > ./dept.txt
),我发现一个新添加的aar确实包含与上面报告的相同的依赖项库,因此就排除它。完成了。
implementation ('the-new-library') {
transitive = true
exclude group : 'duplicate-lib-pkg', module:"duplicate-lib-name"
}