Hi Roman, Have you figure out how to exclude the jar befoer publishing? On Monday, July 22, 2013 9:45:58 PM UTC-7, Roman Mazur wrote: > > Yes, this is exactly what I want. > But can I exclude a jar in libs folder from my dependencies before > publishing? > > On Tuesday, 23 July 2013 02:11:29 UTC+3, Xavier Ducrohet wrote: >> >> The requirement on the library is not declared at runtime in this case, >> so this is different from what I understood. >> >> In this case you would add flurry as a dependency on your library but >> remove it from the dependencies when publishing the artifact. Then the app >> would have to manually include the Flurry library if they want to use it. >> >> >> On Fri, Jul 19, 2013 at 11:02 PM, Roman Mazur <[email protected]> wrote: >> >>> Let's imagine a library that provides some Android activities and can >>> integrate with some statistics services, let it be Flurry to illustrate. >>> But it does so only when the app actually uses that SDK. >>> We cannot get Flurry SDK jar from a repository, so that it must be >>> placed into libs folder of our Android library. But our library does not >>> require this jar to provide its core functionality. But now we cannot use >>> our library without omitting Flurry SDK jar being included to application >>> package. >>> I do understand that this library can be divided into two parts, like >>> core and flurry integration. But as for me, going the described way can be >>> useful too. >>> >>> >>> On 19 July 2013 19:26, Xavier Ducrohet <[email protected]> wrote: >>> >>>> If it's determined at runtime whether the lib is needed or not, then >>>> it's still needed to be packaged in case it's needed at runtime. am I >>>> missing something? >>>> >>>> >>>> On Tue, Jul 9, 2013 at 12:33 AM, Roman Mazur <[email protected]>wrote: >>>> >>>>> What if a jar placed in the libs directory is optional and its >>>>> presence is determined in runtime by the library? Is there a way to >>>>> exclude >>>>> it from aar package? >>>>> >>>>> >>>>> On Friday, 24 May 2013 22:26:52 UTC+3, Xavier Ducrohet wrote: >>>>> >>>>>> This is expected when referencing local jars from library projects. >>>>>> There's no way around it, we need to include it in aar. >>>>>> >>>>>> I'm working right now to have those in a repository so that you can >>>>>> reference artifact instead which will allow Gradle to resolve the >>>>>> dependencies correctly when building an app using different library >>>>>> projects that all depends on support-v4 or other support libs. >>>>>> >>>>>> >>>>>> On Fri, May 24, 2013 at 12:24 PM, Traun Leyden >>>>>> <[email protected]>wrote: >>>>>> >>>>>>> >>>>>>> I'm creating a library using this build.gradle: >>>>>>> >>>>>>> ... >>>>>>> repositories { >>>>>>> mavenCentral() >>>>>>> } >>>>>>> >>>>>>> dependencies { >>>>>>> >>>>>>> compile files('libs/android-support-v4.jar') >>>>>>> >>>>>>> instrumentTestCompile 'commons-io:commons-io:2.0.1' >>>>>>> >>>>>>> compile 'org.codehaus.jackson:jackson-core-asl:1.9.2' >>>>>>> compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.2' >>>>>>> >>>>>>> } >>>>>>> >>>>>>> uploadArchives { >>>>>>> repositories { >>>>>>> mavenDeployer { >>>>>>> repository(url: uri("../testrepo")) >>>>>>> .. >>>>>>> } >>>>>>> } >>>>>>> } >>>>>>> .. >>>>>>> >>>>>>> >>>>>>> and then I'm running "./gradlew :CBLite:uploadArchives", which >>>>>>> causes an .aar to be generated in the local testrepo directory. When I >>>>>>> unzip the .aar, I can see that it contains lib/ android-support- >>>>>>> v4.jar. >>>>>>> >>>>>>> The problems start when I try to use the generated .aar as a >>>>>>> dependency in another project. Here's the build.gradle from the >>>>>>> project >>>>>>> which consumes this dependency: >>>>>>> >>>>>>> ... >>>>>>> repositories { >>>>>>> mavenCentral() >>>>>>> maven { >>>>>>> url "file:///../couchbase-lite-android/CouchbaseLiteProject/ >>>>>>> testrepo" >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> dependencies { >>>>>>> compile files('libs/android-support-v4.jar') >>>>>>> compile 'com.couchbase.cblite:CBLite:1.0' >>>>>>> } >>>>>>> ... >>>>>>> >>>>>>> >>>>>>> when I try to build the project with "./gradlew assemble", I get >>>>>>> this error: >>>>>>> >>>>>>> :HelloCBLite:dexDebug >>>>>>> >>>>>>> UNEXPECTED TOP-LEVEL EXCEPTION: >>>>>>> java.lang.IllegalArgumentException: already added: >>>>>>> Landroid/support/v4/app/ActivityCompatHoneycomb; >>>>>>> at com.android.dx.dex.file.ClassDefsSection.add( >>>>>>> ClassDefsSection.java:123) >>>>>>> at com.android.dx.dex.file.DexFile.add(DexFile.java:163) >>>>>>> at com.android.dx.command.dexer.Main.processClass(Main.java:490) >>>>>>> at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459) >>>>>>> at com.android.dx.command.dexer.Main.access$400(Main.java:67) >>>>>>> at com.android.dx.command.dexer.Main$1.processFileBytes(Main. >>>>>>> java:398) >>>>>>> at com.android.dx.cf.direct.ClassPathOpener.processArchive( >>>>>>> ClassPathOpener.java:245) >>>>>>> at com.android.dx.cf.direct.ClassPathOpener.processOne( >>>>>>> ClassPathOpener.java:131) >>>>>>> at com.android.dx.cf.direct.ClassPathOpener.process( >>>>>>> ClassPathOpener.java:109) >>>>>>> at com.android.dx.command.dexer.Main.processOne(Main.java:422) >>>>>>> at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333) >>>>>>> at com.android.dx.command.dexer.Main.run(Main.java:209) >>>>>>> at com.android.dx.command.dexer.Main.main(Main.java:174) >>>>>>> at com.android.dx.command.Main.main(Main.java:91) >>>>>>> 1 error; aborting >>>>>>> :HelloCBLite:dexDebug FAILED >>>>>>> >>>>>>> FAILURE: Build failed with an exception. >>>>>>> >>>>>>> * What went wrong: >>>>>>> Execution failed for task ':HelloCBLite:dexDebug'. >>>>>>> > Running /Applications/Android >>>>>>> > Studio.app/sdk/build-tools/android-4.2.2/dx >>>>>>> failed. See output >>>>>>> >>>>>>> * Try: >>>>>>> Run with --stacktrace option to get the stack trace. Run with --info >>>>>>> or --debug option to get more log output. >>>>>>> >>>>>>> >>>>>>> >>>>>>> From the error, it looks like it's trying to add in classes from >>>>>>> android-support-v4.jar into the classes.dex, which have already been >>>>>>> added >>>>>>> since they were included in the dependency .aar. >>>>>>> >>>>>>> Is the .aar of a library supposed to contain android-support-v4.jar? >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "adt-dev" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> >>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Xavier Ducrohet >>>>>> Android SDK Tech Lead >>>>>> Google Inc. >>>>>> http://developer.android.com | http://tools.android.com >>>>>> >>>>>> Please do not send me questions directly. Thanks! >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "adt-dev" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> Xavier Ducrohet >>>> Android SDK Tech Lead >>>> Google Inc. >>>> http://developer.android.com | http://tools.android.com >>>> >>>> Please do not send me questions directly. Thanks! >>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "adt-dev" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/adt-dev/l1gELhPSSkM/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> >>> >>> -- >>> Best regards, >>> Roman Mazur >>> >>> Head of Android/Java Unit at Stanfy (http://stanfy.com.ua) >>> Skype: roman.mazur.f >>> LinkedIn: http://ua.linkedin.com/in/romanmazur >>> Twitter: http://twitter.com/roman_mazur >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "adt-dev" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> >> -- >> Xavier Ducrohet >> Android SDK Tech Lead >> Google Inc. >> http://developer.android.com | http://tools.android.com >> >> Please do not send me questions directly. Thanks! >> >
-- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
