大家好,当我尝试添加 admob SDK 时出现此错误:
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.gms.security.ProviderInstaller
我试过了
使缓存失效
清理和重建
使用 ./gradlew build --stacktrace --info 命令
但没有成功。
这是我每次得到的:
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: com.google.android.gms.security.ProviderInstaller
这是我的应用程序 build.grable :
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 之后,我仍然找不到任何解决方案,希望我能在这里找到它
最佳答案
将 maven { url 'https://maven.fabric.io/public' }
添加到您的项目 build.gradle。如下图。这为我修复了它。
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
}
关于java - 由 : com. android.tools.r8.utils.AbortException : Error: Program type already present: com. google.android.gms.security.ProviderInstaller 引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53374634/