I have upgraded my android studio .. and I found many problems in the latest version
Although many similar questions exist, I checked the answers to all and none of them worked for me!
Here is the error I'm facing while compiling the code:
Program type already present: android.support.v4.app.BackStackRecord$Op Message{kind=ERROR, text=Program type already present: android.support.v4.app.BackStackRecord$Op, sources=[Unknown source file], tool name=Optional.of(D8)}
Here is my gradle file
project:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.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://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.alcantara.bugismart"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
}
You can tell me if there is anything else to add to understand what I'm doing or where I'm wrong.
The problem probably because of duplicated support library. This dependency:
is using old version of support library. Try excluding the support library with:
You need to check your dependencies with the following command:
The put this below gradle
implementation 'com.android.support:support-v4:27.1.1'
An alternative to the accepted answer is to tell gradle to force the newer version:
This can be more convenient when you have many dependencies.
see also: Answer to "How can I force Gradle to set the same version for two dependencies?"
enter image description here I tried those :
implementation (project(':libxmiimp')) {exclude group: 'com.android.support', module: 'support-v4'}
But my probleme was that Android-support-v4.jar somehow got into my local android library`s lib folder.... Deleting it fixed my problem
Also check your libs folder because
will pick all jars from there too. You might have jars duplicating each other or your lower implementations.
I had duplicates in my libs and got this problem.