What does Program type already present mean?
This problem usually come from a naming conflict, in your case the support-v4 library, which is use by several libraries.
To find the list of dependencies for the module app
(default module's name for the app) we can do a gradlew app:dependencies
to retrieve a list of all the libraries.
We found that support-v4
is used by:
//short version of the dependencies list highlighting support-v4
+--- com.android.support:support-v13:27.1.0
| \--- com.android.support:support-v4:27.1.0
+--- com.google.android.gms:play-services-maps:12.0.1
| +--- com.google.android.gms:play-services-base:12.0.1
| | +--- com.google.android.gms:play-services-basement:12.0.1
| | | +--- com.android.support:support-v4:26.1.0 -> 27.1.0 (*)
+--- org.eclipse.paho:org.eclipse.paho.android.service:1.0.2
| +--- com.google.android:support-v4:r7 // <- problem here
We see that the support-v4 on Maps will use the version provided from support-v13.
We also see that the eclipse library is using another version (r7 ??).
To resolve your issue, you can try to exclude the module support-v4
from this eclipse library like this:
implementation ('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
Then you should be able to compile your application.
Btw you should take care that the eclipse module won't break by testing your code.
Getting Program type already present error in Android Studio
After 2 days of RND, finally I got the answer. Adding below code in my app-level build.gradle file worked for me--
android {
dexOptions {
preDexLibraries = false
}
}
For more details, please check the answer given by "iceman" on this post.
What is Program type already present?
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
downgrade the version of dependency to
implementation 'com.android.support:appcompat-v7:27.1.0'
and also add the design dependency
implementation 'com.android.support:design:27.1.0'
check it once this works for me
AGPBI: {kind:error,text:Program type already present:
Starting from version 18.0.0
dependency com.google.android.gms:play-services-ads
uses AndroidX packages instead of Support Library. This dependency adds androidx libraries to your project transitively, you can check it using "gradlew app:dependencies" task:
+--- com.google.android.gms:play-services-ads:18.0.0
| +--- androidx.collection:collection:1.0.0
| | \--- androidx.annotation:annotation:1.0.0
| +--- androidx.core:core:1.0.0
| | +--- androidx.annotation:annotation:1.0.0
| | +--- androidx.collection:collection:1.0.0 (*)
| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0
| | | +--- androidx.lifecycle:lifecycle-common:2.0.0
| | | | \--- androidx.annotation:annotation:1.0.0
| | | +--- androidx.arch.core:core-common:2.0.0
| | | | \--- androidx.annotation:annotation:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0
| | \--- androidx.versionedparcelable:versionedparcelable:1.0.0
...
Each androidX dependency contains both android
and androidx
packages. Since gradle sees two different dependencies with the same packages inside, it has no other choice but to throw an error.
As a solution, you can downgrade your 'com.google.android.gms:play-services-ads' to version 17.2.1, since it's the last version that uses old support packages. Other solution might be migrating your project to AndroidX
Android program type already present error
one of these lines might define ff.ecochallenges.game
twice:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":garden-release")
implementation project(":game")
would assume, that there either is a .jar
contained in the libs
directory
or module garden-release
might have a dependency on module game
.
eg. you could use api project(":game")
in module garden-release
.
Program type already present: BuildConfig
You are getting this error because you a have library module which has the same package name as the app module.
The solution would be to change package name of your library module. You can follow the accepted answer in this SO which describes how to change the package name in android studio.
Error: Program type already present: androidx.core.R
You have a problem with the order of plugins applied.
apply plugin: 'com.google.gms.google-services'
This should always be kept at the end of file.
Also, apply plugin: "io.fabric"
should be applied after com.android.application
.
If you still have confusions on build.gradle
. Edit your question including both buid.gradle
files from app and root project, and inform me by commenting on this answer.
apply plugin: 'com.android.application'
apply plugin: "io.fabric"
apply plugin: 'kotlin-android'
apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.trevexs.sengaapp"
minSdkVersion 19
targetSdkVersion 28
versionCode 5
versionName "1.5.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
versionNameSuffix "-DEBUG"
}
}
dataBinding {
enabled = true
}
testOptions {
unitTests {
returnDefaultValues = true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.media:media:1.0.1'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'com.romandanylyk:pageindicatorview:1.0.2'
implementation 'com.google.code.gson:gson:2.8.5'
//fire-base staff
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.firebase:firebase-firestore:20.1.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-storage:18.0.0'
// Required for instrumented tests
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:core:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
testImplementation "org.mockito:mockito-core:1.10.19"
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
// Optional -- Hamcrest library
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
// Optional -- UI testing with Espresso
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Optional -- UI testing with UI Automator
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.annotation:annotation:1.0.1'
//kotlin staff
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
//material design staff
implementation 'com.google.android.material:material:1.0.0'
//circular image
implementation 'de.hdodenhof:circleimageview:3.0.0'
//crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
//picasso
implementation 'com.squareup.picasso:picasso:2.71828'
//dialog flow dependencies
implementation 'com.github.kittinunf.fuel:fuel-android:2.1.0'
implementation 'com.github.bassaer:chatmessageview:2.0.1'
implementation 'ai.api:sdk:2.0.7'
implementation 'ai.api:libai:1.6.12'
}
apply plugin: 'com.google.gms.google-services'
Related Topics
Insufficent_Storage_Memory Message While Install 50 Mb APK in Emulator
Mysterious Stacktrace in Android Developer Console (Bitmap Size Exceeds 32Bits)
Android Stock Browser Not Respecting CSS Overflow
Android: I Want Use My Custom Font with Webviewb
Turning on Wifi Using Wifimanager Stops to Work on Android 10
Android - Choose File Button in Webview
Tracking Progress of Multipart File Upload Using Okhttp
What's "Requestcode" Used for on Pendingintent
Clicking on Notification Is Not Starting Intended Activity
Air 3 Native Extensions for Android - Can I/How to Include 3Rd Party Libraries
Borders on Certain Zoom Levels on Webpage
Android App Installation Failed: Package Com.My.App Has No Certificates at Entry Androidmanifest.Xml
How to Paging Query from Firebase Using Android Firebaseui
Android: Save File Permanently (Even After Clear Data/Uninstall)
How to Make a Phone Number Clickable on an iPhone or Android Phone to Make a Call in HTML