Error: Program type already present when building project
I'm using an 'aar' library which I created.
In both, my project and the library, there is a dependency implementation of Conceal library (each from its own lib folder).
When I build the project after importing the library and using ProGuard obfuscation, I get this error message:
Error: Program type already present: com.facebook.crypto.cipher.NativeGCMCipher
How can I resolve this problem?



add a comment |
I'm using an 'aar' library which I created.
In both, my project and the library, there is a dependency implementation of Conceal library (each from its own lib folder).
When I build the project after importing the library and using ProGuard obfuscation, I get this error message:
Error: Program type already present: com.facebook.crypto.cipher.NativeGCMCipher
How can I resolve this problem?



add a comment |
I'm using an 'aar' library which I created.
In both, my project and the library, there is a dependency implementation of Conceal library (each from its own lib folder).
When I build the project after importing the library and using ProGuard obfuscation, I get this error message:
Error: Program type already present: com.facebook.crypto.cipher.NativeGCMCipher
How can I resolve this problem?



I'm using an 'aar' library which I created.
In both, my project and the library, there is a dependency implementation of Conceal library (each from its own lib folder).
When I build the project after importing the library and using ProGuard obfuscation, I get this error message:
Error: Program type already present: com.facebook.crypto.cipher.NativeGCMCipher
How can I resolve this problem?






edited Jan 2 at 13:45


Martin Zeitler
19.2k34373
19.2k34373
asked Jan 2 at 11:48
ItayItay
7311
7311
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
this error say you are importing the dependency which already imported in project.
solution :- remove or exclude this dependency
ex:-
compile ('com.github.ganfra:material-spinner:1.1.1'){
exclude group: 'com.nineoldandroids'
}
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
@Itay the class name is not the package name; run./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.
– Martin Zeitler
Jan 2 at 12:20
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
|
show 2 more comments
according to mavenCentral()
, this is the package name (which could be used instead of .jar
):
// https://mvnrepository.com/artifact/com.facebook.conceal/conceal
implementation "com.facebook.conceal:conceal:2.0.2"
therefore the exclusion should look about like this:
implementation( project(":libraryproject") ) {
exclude group: "com.facebook.conceal"
}
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get anyGradle DSL method not found: 'exclude()'
, you might be missing the surrounding()
brackets.
– Martin Zeitler
Jan 2 at 13:27
add a comment |
To my understanding, the error means that I imported a dependency that already imported in the project (once in the project and once in the library).
The suggested solutions of @Mayur Dabhi and @Martin Zeitler had the right approach, but unfortunately, I wasn't able to get the exclude command working.
finally, with the help of @Martin Zeitler, I replaced:
implementation files('libs/conceal_android.jar')
implementation files('libs/libconceal.jar')
with:
implementation "com.facebook.conceal:conceal:2.0.2"
meaning I removed the 'Conceal' jar files from the 'lib' folder and imported the dependency. After that, the error message disappeared and I managed to build the project.
Thanks for anyone who tried to help :)
add a comment |
Add this to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
It will auto resolve the android.support/androidx conflicts that you may have in the dependencies in your libraries.
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54005801%2ferror-program-type-already-present-when-building-project%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
this error say you are importing the dependency which already imported in project.
solution :- remove or exclude this dependency
ex:-
compile ('com.github.ganfra:material-spinner:1.1.1'){
exclude group: 'com.nineoldandroids'
}
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
@Itay the class name is not the package name; run./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.
– Martin Zeitler
Jan 2 at 12:20
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
|
show 2 more comments
this error say you are importing the dependency which already imported in project.
solution :- remove or exclude this dependency
ex:-
compile ('com.github.ganfra:material-spinner:1.1.1'){
exclude group: 'com.nineoldandroids'
}
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
@Itay the class name is not the package name; run./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.
– Martin Zeitler
Jan 2 at 12:20
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
|
show 2 more comments
this error say you are importing the dependency which already imported in project.
solution :- remove or exclude this dependency
ex:-
compile ('com.github.ganfra:material-spinner:1.1.1'){
exclude group: 'com.nineoldandroids'
}
this error say you are importing the dependency which already imported in project.
solution :- remove or exclude this dependency
ex:-
compile ('com.github.ganfra:material-spinner:1.1.1'){
exclude group: 'com.nineoldandroids'
}
edited Jan 2 at 12:07
answered Jan 2 at 11:58


Mayur DabhiMayur Dabhi
359211
359211
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
@Itay the class name is not the package name; run./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.
– Martin Zeitler
Jan 2 at 12:20
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
|
show 2 more comments
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
@Itay the class name is not the package name; run./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.
– Martin Zeitler
Jan 2 at 12:20
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
I understand that the dependency imported already, but when remove it from the library I can't build because its missing the library, and when I remove it from the project it can't import from the library. How can I exclude it from the library?
– Itay
Jan 2 at 12:02
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
see i have edited by example
– Mayur Dabhi
Jan 2 at 12:08
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
I'm implementing using a jar file: implementation files('libs/conceal_android.jar') implementation files('libs/libconceal.jar') should I write: implementation files('libs/libconceal.jar') {exclude group: 'com.facebook.crypto.cipher.NativeGCMCipher'}
– Itay
Jan 2 at 12:13
@Itay the class name is not the package name; run
./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.– Martin Zeitler
Jan 2 at 12:20
@Itay the class name is not the package name; run
./gradlew app:dependencies > dependencies.txt
and add it to the question; then one probably can answer that.– Martin Zeitler
Jan 2 at 12:20
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
it gives me an error - "Gradle DSL method not found: 'exclude()' " when I write - "implementation files('libs/libconceal.jar') exclude(group: 'com.facebook.crypto.Conceal') "
– Itay
Jan 2 at 12:47
|
show 2 more comments
according to mavenCentral()
, this is the package name (which could be used instead of .jar
):
// https://mvnrepository.com/artifact/com.facebook.conceal/conceal
implementation "com.facebook.conceal:conceal:2.0.2"
therefore the exclusion should look about like this:
implementation( project(":libraryproject") ) {
exclude group: "com.facebook.conceal"
}
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get anyGradle DSL method not found: 'exclude()'
, you might be missing the surrounding()
brackets.
– Martin Zeitler
Jan 2 at 13:27
add a comment |
according to mavenCentral()
, this is the package name (which could be used instead of .jar
):
// https://mvnrepository.com/artifact/com.facebook.conceal/conceal
implementation "com.facebook.conceal:conceal:2.0.2"
therefore the exclusion should look about like this:
implementation( project(":libraryproject") ) {
exclude group: "com.facebook.conceal"
}
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get anyGradle DSL method not found: 'exclude()'
, you might be missing the surrounding()
brackets.
– Martin Zeitler
Jan 2 at 13:27
add a comment |
according to mavenCentral()
, this is the package name (which could be used instead of .jar
):
// https://mvnrepository.com/artifact/com.facebook.conceal/conceal
implementation "com.facebook.conceal:conceal:2.0.2"
therefore the exclusion should look about like this:
implementation( project(":libraryproject") ) {
exclude group: "com.facebook.conceal"
}
according to mavenCentral()
, this is the package name (which could be used instead of .jar
):
// https://mvnrepository.com/artifact/com.facebook.conceal/conceal
implementation "com.facebook.conceal:conceal:2.0.2"
therefore the exclusion should look about like this:
implementation( project(":libraryproject") ) {
exclude group: "com.facebook.conceal"
}
edited Jan 2 at 13:29
answered Jan 2 at 12:55


Martin ZeitlerMartin Zeitler
19.2k34373
19.2k34373
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get anyGradle DSL method not found: 'exclude()'
, you might be missing the surrounding()
brackets.
– Martin Zeitler
Jan 2 at 13:27
add a comment |
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get anyGradle DSL method not found: 'exclude()'
, you might be missing the surrounding()
brackets.
– Martin Zeitler
Jan 2 at 13:27
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
I get "Gradle DSL method not found: 'exclude()' " error
– Itay
Jan 2 at 13:01
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get any
Gradle DSL method not found: 'exclude()'
, you might be missing the surrounding ()
brackets.– Martin Zeitler
Jan 2 at 13:27
@Itay are you certain to have used the code as displayed? that syntax is correct. if you get any
Gradle DSL method not found: 'exclude()'
, you might be missing the surrounding ()
brackets.– Martin Zeitler
Jan 2 at 13:27
add a comment |
To my understanding, the error means that I imported a dependency that already imported in the project (once in the project and once in the library).
The suggested solutions of @Mayur Dabhi and @Martin Zeitler had the right approach, but unfortunately, I wasn't able to get the exclude command working.
finally, with the help of @Martin Zeitler, I replaced:
implementation files('libs/conceal_android.jar')
implementation files('libs/libconceal.jar')
with:
implementation "com.facebook.conceal:conceal:2.0.2"
meaning I removed the 'Conceal' jar files from the 'lib' folder and imported the dependency. After that, the error message disappeared and I managed to build the project.
Thanks for anyone who tried to help :)
add a comment |
To my understanding, the error means that I imported a dependency that already imported in the project (once in the project and once in the library).
The suggested solutions of @Mayur Dabhi and @Martin Zeitler had the right approach, but unfortunately, I wasn't able to get the exclude command working.
finally, with the help of @Martin Zeitler, I replaced:
implementation files('libs/conceal_android.jar')
implementation files('libs/libconceal.jar')
with:
implementation "com.facebook.conceal:conceal:2.0.2"
meaning I removed the 'Conceal' jar files from the 'lib' folder and imported the dependency. After that, the error message disappeared and I managed to build the project.
Thanks for anyone who tried to help :)
add a comment |
To my understanding, the error means that I imported a dependency that already imported in the project (once in the project and once in the library).
The suggested solutions of @Mayur Dabhi and @Martin Zeitler had the right approach, but unfortunately, I wasn't able to get the exclude command working.
finally, with the help of @Martin Zeitler, I replaced:
implementation files('libs/conceal_android.jar')
implementation files('libs/libconceal.jar')
with:
implementation "com.facebook.conceal:conceal:2.0.2"
meaning I removed the 'Conceal' jar files from the 'lib' folder and imported the dependency. After that, the error message disappeared and I managed to build the project.
Thanks for anyone who tried to help :)
To my understanding, the error means that I imported a dependency that already imported in the project (once in the project and once in the library).
The suggested solutions of @Mayur Dabhi and @Martin Zeitler had the right approach, but unfortunately, I wasn't able to get the exclude command working.
finally, with the help of @Martin Zeitler, I replaced:
implementation files('libs/conceal_android.jar')
implementation files('libs/libconceal.jar')
with:
implementation "com.facebook.conceal:conceal:2.0.2"
meaning I removed the 'Conceal' jar files from the 'lib' folder and imported the dependency. After that, the error message disappeared and I managed to build the project.
Thanks for anyone who tried to help :)
answered Jan 2 at 14:11
ItayItay
7311
7311
add a comment |
add a comment |
Add this to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
It will auto resolve the android.support/androidx conflicts that you may have in the dependencies in your libraries.
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
add a comment |
Add this to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
It will auto resolve the android.support/androidx conflicts that you may have in the dependencies in your libraries.
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
add a comment |
Add this to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
It will auto resolve the android.support/androidx conflicts that you may have in the dependencies in your libraries.
Add this to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
It will auto resolve the android.support/androidx conflicts that you may have in the dependencies in your libraries.
answered Jan 2 at 12:05
muragedenmurageden
469
469
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
add a comment |
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
I have a 11! Wow, if I had a 0. That would be worse
– murageden
Jan 2 at 13:08
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
plus am generous enough to give you one, for the down vote
– murageden
Jan 2 at 13:09
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
66% of your answers feature the same suggestion; with canned answers, you won't score.
– Martin Zeitler
Jan 2 at 13:38
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
Forget the score. All I am to do here is to provide solutions to problems. Or at least try. I see your attitude tho. I'll see you 👁️
– murageden
Jan 2 at 17:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54005801%2ferror-program-type-already-present-when-building-project%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown