- Duplicate class android.support.customtabs.BuildConfig found in modules classes.jar #762
- Comments
- murillogalvezj commented May 21, 2019 •
- murillogalvezj commented May 22, 2019
- jkasten2 commented May 31, 2019 •
- rgomezp commented Jun 11, 2019
- SebastienTainon commented Oct 9, 2019 •
- pharidali commented Mar 8, 2020 •
- NazarKohh commented Feb 19, 2021
- dex fails because a BuildConfig class from an aar lib is there twice #326
- Comments
- Shusshu commented Apr 10, 2014
- What steps will reproduce the problem?
- What is the expected output?
- What do you see instead?
- What version of maven-android-plugin are you using?
- What are the complete output lines of «mvn -version» on your machine?
- Please provide any additional information below.
- Shusshu commented Apr 14, 2014
- Shusshu commented Apr 14, 2014
- Shusshu commented Apr 24, 2014
- gabriel01 commented Jun 11, 2014
- Shusshu commented Jun 11, 2014
- gabriel01 commented Jun 11, 2014
- william-ferguson-au commented Jun 11, 2014
- sensorcast commented Jun 12, 2014
- william-ferguson-au commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- Shusshu commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- william-ferguson-au commented Jun 12, 2014
- sensorcast commented Jun 12, 2014
- gabriel01 commented Jun 13, 2014
- greek1979 commented Jun 29, 2014
- Shusshu commented Jun 29, 2014
- greek1979 commented Jun 29, 2014
Duplicate class android.support.customtabs.BuildConfig found in modules classes.jar #762
Comments
murillogalvezj commented May 21, 2019 •
When i add all the code of OneSignal into the build.gradle in module app i get an error: Duplicate class android.support.customtabs.BuildConfig found in modules classes.jar (com.android.support:customtabs:27.0.2) and classes.jar (com.github.GoogleChrome.custom-tabs-client:customtabs:f7f1f6483c)
this is my gradle:
buildscript <
repositories <
maven < url 'https://plugins.gradle.org/m2/'>
>
dependencies <
classpath ‘gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1’
>
>
apply plugin: ‘com.onesignal.androidsdk.onesignal-gradle-plugin’
apply plugin: ‘com.android.application’
android <
compileSdkVersion 28
defaultConfig <
manifestPlaceholders = [
onesignal_app_id: ’49c4282d-f628-4994-a222-ddf6f8bcb57a’,
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: ‘REMOTE’
]
dependencies <
implementation fileTree(include: [‘*.jar’], dir: ‘libs’)
implementation ‘com.github.GoogleChrome.custom-tabs-client:customtabs:f7f1f6483c’
implementation ‘com.onesignal:OneSignal:3.10.8’
>
this is my manifest:
Im building a pwa to upload to the play store, and everything goes well, but as soon as i add all the code of the oneSignal the error appears
I already tried to exclude com.android.support:customtabs:27.0.2 but it keeps me showing the error.
The text was updated successfully, but these errors were encountered:
murillogalvezj commented May 22, 2019
It looks like the problems is caused when i add the dependency
dependencies <
implementation ‘com.onesignal:OneSignal:[3.9.1, 3.99.99]’
>
when i add the dependency my Main Class gets broke with a lot of errors
jkasten2 commented May 31, 2019 •
@murillogalvezj I am not sure where the module com.github.GoogleChrome.custom-tabs-client:customtabs is being imported from or what it’s dependencies are. Does this provide something different than the Android Support Library / AndroidX version of customtabs? com.android.support:customtabs
com.github.GoogleChrome.custom-tabs-client:customtabs might be using AndroidX so you may need to follow this guide.
https://developer.android.com/jetpack/androidx/migrate#migrate
rgomezp commented Jun 11, 2019
Closing due to no response
SebastienTainon commented Oct 9, 2019 •
Hello, I have exactly the same problem @jkasten2
I have followed the Google guide about how to set up a TWA: https://developers.google.com/web/updates/2019/02/using-twa (the com.github.GoogleChrome.custom-tabs-client:customtabs dependency is necessary for this).
It works great and then I want to integrate OneSignal into my TWA, so I add the OneSignal dependency in my build.gradle file and at this point it breaks because of these errors:
Could it be reopened @rgomezp ? Is there a way to solve these duplication errors? Thanks.
Also the question could be asked like this: it is possible to use OneSignal in a TWA?
pharidali commented Mar 8, 2020 •
NazarKohh commented Feb 19, 2021
plugins <
id ‘com.onesignal.androidsdk.onesignal-gradle-plugin’
id ‘com.android.application’
id ‘kotlin-android’
>
android <
compileSdkVersion 30
buildToolsVersion «30.0.3»
Источник
dex fails because a BuildConfig class from an aar lib is there twice #326
Comments
Shusshu commented Apr 10, 2014
What steps will reproduce the problem?
OR the appcompat-v7 lib
What is the expected output?
What do you see instead?
[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Lcom/readystatesoftware/systembartint/BuildConfig;
What version of maven-android-plugin are you using?
3.9.0-rc.1 & current 3.9.0-SNAPSHOT (2014/04/10)
What are the complete output lines of «mvn -version» on your machine?
3.2.1
java 1.7.0_51
Please provide any additional information below.
In this library the BuildConfig is included in the aar (classes.jar)
But for ActionBarSherlock the BuildConfig is not included in the aar (based on comments in the GenerateSourcesMojo).
Should the aar contain the BuildConfig or should android-maven-plugin generate it or should it check if it needs to generate it or not?
The text was updated successfully, but these errors were encountered:
Shusshu commented Apr 14, 2014
I see 2 ways to fix the problem.
A. Removing the following code in generateBuildConfig method. (Non backwards compatible)
And also include the BuildConfig.class in the aar
B. Making the code in generateBuildConfig to generate BuildConfig only if it’s not present in the classes.jar (backwards compatible)
And also include the BuildConfig.class in the aar
So the first way isn’t backwards compatible but is the proper way to do it.
Shusshu commented Apr 14, 2014
#328 implement solution 1.
I will look into solution 2 to ensure backwards compatibility
Shusshu commented Apr 24, 2014
gabriel01 commented Jun 11, 2014
when I compile with version 3.8.2 I get the reported error:
[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Lcom/readystatesoftware/systembartint/BuildConfig;
But when using 3.9.0-rc.2 I’ll get the following error in my library project:
Error: No resource found that matches the given name (at ‘value’ with value ‘@integer/google_play_services_version’).
With 3.8.2 all my library projects build successful. Is this a new bug or a misconfiguration on my site?
Shusshu commented Jun 11, 2014
It’s another problem:
gabriel01 commented Jun 11, 2014
The manifest entry is set. The app project and all libraries build successfully in Eclipse. The library projects also build successfully with Maven 3.8.2. But the app project fails with 3.8.2.
Using 3.9.0-rc.2 leads to the missing value error. But I haven’t changed anything in the manifest?!
william-ferguson-au commented Jun 11, 2014
Post a link to a cut down project that fails.
On Thu, Jun 12, 2014 at 3:49 AM, gabriel01 notifications@github.com wrote:
The manifest entry is set. The app project and all libraries build
successfully in Eclipse. The library projects also build successfully with
Maven 3.8.2. But the app project fails with 3.8.2.
Using 3.9.0-rc.2 leads to the missing value error. But I haven’t changed
anything in the manifest?!
—
Reply to this email directly or view it on GitHub
#326 (comment)
.
sensorcast commented Jun 12, 2014
I’ve spent a couple of hours on his now as well.
Maven dependencies:
com.google.android
android
4.3
provided
com.jayway.maven.plugins.android.generation2
android-maven-plugin
3.9.0-rc.2
The error:
[INFO] — android-maven-plugin:3.9.0-rc.2:dex (default-dex) @ sensorcast-android-datalogger —
[INFO] Convert classes to Dex : /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes.dex
[INFO]
[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Landroid/support/v7/appcompat/BuildConfig;
[INFO] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
[INFO] at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
[INFO] at com.android.dx.command.dexer.Main.processClass(Main.java:685)
[INFO] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
[INFO] at com.android.dx.command.dexer.Main.access$600(Main.java:78)
[INFO] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
[INFO] at com.android.dx.command.dexer.Main.processOne(Main.java:596)
[INFO] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
[INFO] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
[INFO] at com.android.dx.command.dexer.Main.run(Main.java:230)
[INFO] at com.android.dx.command.dexer.Main.main(Main.java:199)
[INFO] at com.android.dx.command.Main.main(Main.java:103)
[INFO] 1 error; aborting
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 12.297 s
[INFO] Finished at: 2014-06-11T22:01:59-08:00
[INFO] Final Memory: 29M/858M
[INFO] ————————————————————————
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:dex (default-dex) on project sensorcast-android-datalogger: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android && /opt/java/jdk1.7.0_11/jre/bin/java -Xmx1024M -jar /opt/android/current-version/build-tools/19.0.3/lib/dx.jar —dex —output=/home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes.dex /home/jeffp/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar /home/jeffp/.m2/repository/com/wonkware/ww-core-android/1.0.0-SNAPSHOT/ww-core-android-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/org/sensorcast/sensorcast-android-core/1.0.0-SNAPSHOT/sensorcast-android-core-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/com/android/support/appcompat-v7/19.1.0/appcompat-v7-19.1.0.jar /home/jeffp/.m2/repository/org/simpleframework/simple-xml/2.7.1/simple-xml-2.7.1.jar /home/jeffp/.m2/repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0.jar /home/jeffp/.m2/repository/com/wonkware/ww-core/1.0.0-SNAPSHOT/ww-core-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/org/sensorcast/sensorcast-model/1.0.0-SNAPSHOT/sensorcast-model-1.0.0-SNAPSHOT.jar /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes
Good instructions regarding how to use the plugin OR how to craft the right dependency type (.aar, .apklib) and wire it all up are hard to come by.
william-ferguson-au commented Jun 12, 2014
Why are you providing a dependency on the apklib AND the jar? A dep on the apklib should be sufficient. And again, without a link to a project that is failing it becomes just guesswork for us to try and diagnose.
sensorcast commented Jun 12, 2014
I’ve cobbled together this much from the web. Like I said the docs are not clear.
If I take out the library then I get all kinds of errors it can’t find anything. BUT, your question makes me think the apklib is bundled improperly. There were 2 sets of instructions: deploy the .aar file, google provides in the extras, as is, declaring it an apklib; and the «zip the project» version. I need to go back and verify this. (but I must sleep first.)
The project is not in github yet.
Shusshu commented Jun 12, 2014
Try aar instead of apklib. it’s better anyway.
sensorcast commented Jun 12, 2014
Using just the .aar:
[INFO] — android-maven-plugin:3.9.0-rc.2:dex (default-dex) @ sensorcast-android-datalogger —
[INFO] Convert classes to Dex : /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes.dex
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 25.135 s
[INFO] Finished at: 2014-06-12T10:41:09-08:00
[INFO] Final Memory: 22M/481M
[INFO] ————————————————————————
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:dex (default-dex) on project sensorcast-android-datalogger: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android && /opt/java/jdk1.7.0_11/jre/bin/java -Xmx1024M -jar /opt/android/current-version/build-tools/19.0.3/lib/dx.jar —dex —output=/home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes.dex /home/jeffp/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar /home/jeffp/.m2/repository/com/wonkware/ww-core-android/1.0.0-SNAPSHOT/ww-core-android-1.0.0-SNAPSHOT.jar /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/unpacked-libs/cas_appcompat-v7/classes.jar /home/jeffp/.m2/repository/org/sensorcast/sensorcast-android-core/1.0.0-SNAPSHOT/sensorcast-android-core-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/org/simpleframework/simple-xml/2.7.1/simple-xml-2.7.1.jar /home/jeffp/.m2/repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0.jar /home/jeffp/.m2/repository/com/wonkware/ww-core/1.0.0-SNAPSHOT/ww-core-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/org/sensorcast/sensorcast-model/1.0.0-SNAPSHOT/sensorcast-model-1.0.0-SNAPSHOT.jar /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes, Result = 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.2:dex (default-dex) on project sensorcast-android-datalogger:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException:
at com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.runDex(DexMojo.java:467)
at com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.execute(DexMojo.java:171)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
. 19 more
Caused by: com.jayway.maven.plugins.android.ExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android && /opt/java/jdk1.7.0_11/jre/bin/java -Xmx1024M -jar /opt/android/current-version/build-tools/19.0.3/lib/dx.jar —dex —output=/home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes.dex /home/jeffp/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar /home/jeffp/.m2/repository/com/wonkware/ww-core-android/1.0.0-SNAPSHOT/ww-core-android-1.0.0-SNAPSHOT.jar /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/unpacked-libs/cas_appcompat-v7/classes.jar /home/jeffp/.m2/repository/org/sensorcast/sensorcast-android-core/1.0.0-SNAPSHOT/sensorcast-android-core-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/org/simpleframework/simple-xml/2.7.1/simple-xml-2.7.1.jar /home/jeffp/.m2/repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0.jar /home/jeffp/.m2/repository/com/wonkware/ww-core/1.0.0-SNAPSHOT/ww-core-1.0.0-SNAPSHOT.jar /home/jeffp/.m2/repository/org/sensorcast/sensorcast-model/1.0.0-SNAPSHOT/sensorcast-model-1.0.0-SNAPSHOT.jar /home/jeffp/Workspace/GSW/gsw-main/gsw-main/gsw-datalogger-android/target/classes, Result = 1
at com.jayway.maven.plugins.android.CommandExecutor$Factory$DefaultCommandExecutor.executeCommand(CommandExecutor.java:252)
at com.jayway.maven.plugins.android.phase08preparepackage.DexMojo.runDex(DexMojo.java:463)
. 22 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
sensorcast commented Jun 12, 2014
Updated android build tools to 19.1.0 and got the same error.
sensorcast commented Jun 12, 2014
OK, my bad: It suddenly started working. Turns out that it was a transient memory resource problem. On another invocation I went to run maven and got:
mvn -e clean package
Error occurred during initialization of VM
Could not reserve enough space for object heap
sensorcast commented Jun 12, 2014
I meant to say, it started working with just the .aar dependency. So, now all I’m using is:
com.android.support
appcompat-v7
19.1.0
aar
without the «support-v4» dependency or the «appcompat-v7» .jar dependency.
sensorcast commented Jun 12, 2014
Apparently. Though it did take a while to sort out the details that the new plugin required a maven update, and the docs are not clear on exactly how to setup the dependencies. You’ve still got that apklib page off your site https://code.google.com/p/maven-android-plugin/wiki/ApkLib.
william-ferguson-au commented Jun 12, 2014
What Maven update? It will run fine with any version of Maven 3.0+, which is the same as 3.8.2.
I have updated the ApkLib page with a deprecation warning in favour of AAR. It would be good to create a page explaining AR creation/consumption. It’s pretty trivial as it’s just like any other maven artifact type. Any takers? What about you @sensorcast ?
sensorcast commented Jun 12, 2014
I was running with Maven 3.0.3 and the plugin spit something out that it was unhappy and needed 3.1 (I think it was 3.1; message is lost at this point). So I installed 3.2.1. (I don’t know where you are getting your Maven binaries from but 3.2.1 is listed as the latest: http://maven.apache.org/download.cgi).
As for .aar: I’m not sure I fully understand it myself except to say that I now have a working version/config using Maven 3.2.1, android-maven-plugin 2.9.0-rc-2, Android 19.1.0 build tools, and appcompat-v7 19.1.0 where this was simply rsync’d to our server from the /extras/android/m2repository — i.e., «sync -av com maven@sensorcast.org:/home/maven/repos/external-free»
gabriel01 commented Jun 13, 2014
Hmm, I replaced the jar/apklib dependency by
com.android.support appcompat-v7 19.1.0 aar Now I get «cannot find symbol : class ActionBarActivity» and «package android.support.v7.app does not exist». But the dependency is definitely. Please find below the pom. Any advice is very appreciated.
Velosys Common Library
greek1979 commented Jun 29, 2014
I am posting here a duplicate comment to stress the issue I am seeing with latest available 3.9.0-rc.2 plugin version. It seems the code change labelled «Solution 2» by both @Shusshu and @marchelo never made it into the master branch, as the very same issue brought up and discussed here is still there.
I have an APK project which depends on one AAR library project, which in turn has a dependency on a third-party library shipped as AAR (a well-known Google Play Services v4). Everything compiles and builds well until we get to dex stage of final APK. There, plugin fails because of a Dex tool error — duplicate BuildConfig class found. The BuildConfig for third-party dependency gets packaged into my library AAR, but then it is produced again when building the final APK, as third-party dependency is still there, it is of AAR type, hence it is handled as such (i.e. both R and BuildConfig are dynamically created)..
Could we somehow 1) tell Dex tool to use only one instance of each duplicate class (for example, the first one), or 2) explicitly re-create BuildConfig for each transitive AAR dependency?
Alternatively, may it be possible to simply and brutally filter out existing BuildConfig instances from transitive AAR dependencies when building APK, as they would be re-created anyway by the ApkMojo goal?
Shusshu commented Jun 29, 2014
Can you create a new issue with a sample project reproducing the problem? that would help fixing it.
greek1979 commented Jun 29, 2014
After spending an hour or so digging through the problem and analyzing whole dependency tree for APK project, two issues were spotted by me. Overall, plugin seems to be doing exactly what it has to, with some minor exceptions I will outline below.
One issue was entirely an in-house edge case, where one of the transitive dependencies was apparently plugged in as both AAR and JAR (legacy of awkward APKLIB support in Eclipse. ), with JAR having that nasty already-generated BuildConfig class. As JAR dependencies are not handled in any special way by the plugin — and this is right — the duplicate BuildConfig ended up in APK project.
The other issue is the way plugin checks for presence of BuildConfig in all AAR dependencies. It does a fine job, BUT each time it checks a transitive dependency, its OWN package namespace is used, not the package name of original AAR artifact that is being built.
I have submitted a fairly simply pull request #403 . This does not seem like a big deal, but would be good to apply the change.
Источник