Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

The mess which is importing Android libraries and jars

  • 17-07-2014 12:58pm
    #1
    Closed Accounts Posts: 19,777 ✭✭✭✭


    Recently I've been working with more and more Android library projects, imported jars and the like, as part of an overall in-house framework.

    Problem is that it's driving me insane because of its almost arbitrary behavour. For example, with one host project, it all work nicely. Then another which does not differ in any significant way I start getting impenetrable ClassNotFoundException errors. Or imports in some cases have no issues, and in other, seemingly identical scenarios, will give me duplicate errors.

    I don't know if the issue is with Eclipse, Android, Ant or what, but what would be nice is some sort of recommended documentation and/or tutorial in this area so that at least I know what the rules and limitations of such imports are supposed to be?


Comments

  • Registered Users, Registered Users 2 Posts: 2,750 ✭✭✭MyPeopleDrankTheSoup


    eclipse is just such a POS. but i'm so used to it and its intricacies that i'm sticking with it. i tried moving to android studio a month ago and it was nice but gradle is an even bigger POS.

    first when i'm trying to fix problems like this in Eclipse, i first clean all the libraries and then my main project. if it's still not working, i decompile the APK with baksmali or JEB Decompiler. it might sound like overkill and lot of messing but it's really pretty easy. then you can just browse the folders of the decompiled app and see what libraries were included in the build and what's causing the problem.


  • Registered Users Posts: 211 ✭✭CrazyFish


    eclipse is just such a POS. but i'm so used to it and its intricacies that i'm sticking with it. i tried moving to android studio a month ago and it was nice but gradle is an even bigger POS.

    first when i'm trying to fix problems like this in Eclipse, i first clean all the libraries and then my main project. if it's still not working, i decompile the APK with baksmali or JEB Decompiler. it might sound like overkill and lot of messing but it's really pretty easy. then you can just browse the folders of the decompiled app and see what libraries were included in the build and what's causing the problem.
    I moved over to using Gradle and Android studio for the last few months and could not go back to using eclipse. I find the dependency management with it very easy and have not had an issue with external dependencies in a long time. Only thing that can be painful is the initial switch over can be a bit hard since it was fairly different from eclipse.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    CrazyFish wrote: »
    Only thing that can be painful is the initial switch over can be a bit hard since it was fairly different from eclipse.
    That's the thing, Studio is still in Beta (and has been for a long time now) and I'm loathed to migrate to it until it graduates to at least version 1.0. I'd hoped that this would have been announced at this years I/O, but alas not.

    On the other hand Eclipse's handling of imports is so flaky, that I seem to spend more time on fixing issues there than anything related to code. Even the ClassNotFoundException error I mentioned above, turned out to be as a result of two classes, in different packages, that had the same name - Ant couldn't get it's head around this.

    What I've been looking for is some sort of practical guide to such builds with Eclipse, that covers the limitations and warns you where stuff that should work doesn't.

    Perhaps taking a chance on Studio is worth it?


  • Registered Users, Registered Users 2 Posts: 11,264 ✭✭✭✭jester77


    That's the thing, Studio is still in Beta (and has been for a long time now) and I'm loathed to migrate to it until it graduates to at least version 1.0. I'd hoped that this would have been announced at this years I/O, but alas not.

    On the other hand Eclipse's handling of imports is so flaky, that I seem to spend more time on fixing issues there than anything related to code. Even the ClassNotFoundException error I mentioned above, turned out to be as a result of two classes, in different packages, that had the same name - Ant couldn't get it's head around this.

    What I've been looking for is some sort of practical guide to such builds with Eclipse, that covers the limitations and warns you where stuff that should work doesn't.

    Perhaps taking a chance on Studio is worth it?

    If you stick with Eclipse then look into maven and you can use your own repo manager, like artifactory or nexus. Will make life a lot easier.

    Studio may be beta, but it is solid and built on top of intellij, so you know you have a solid foundation there. Gradle is nicer than maven with it's groovy support and you can use artifactory or nexus to host your own and 3rd party libs. It has the option to import eclipse projects, haven't tried it myself, have heard mixed results.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe


    You arent using gradle or maven?!


  • Advertisement
  • Closed Accounts Posts: 2,267 ✭✭✭h57xiucj2z946q


    I'm personally using IntelliJ & Maven.

    I'm migrating over to Gradle for one project for smooth integration with f-droid.org and find it ok.

    What do you think is wrong with it georgiecasey ?


  • Registered Users, Registered Users 2 Posts: 2,750 ✭✭✭MyPeopleDrankTheSoup


    one day, my project would be building fine in android studio, the next day i'd get a 'gradle project sync failed' error. it was completely random. i searched a bit but couldn't find an answer. to be honest, i didn't try very hard, just went back to Eclipse.

    i don't like change for the sake of change. is spending the time to grok gradle and android studio going to make me more money? no

    i'd a quick read of commonsware's android chapter on gradle and he mentioned that to use a library project as a dependency, you have to publish it as an AAR artifact. that seems like a lot of messing, i stopped reading there.

    i know it's the future though, but i'll let others crease out the bugs while i pump out more crappy apps in eclipse. i'll give it another go before the end of this year.


  • Closed Accounts Posts: 2,267 ✭✭✭h57xiucj2z946q


    Haha OK fair enough. Yeah android libraries packaged as AAR seems to be the norm now.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    i know it's the future though, but i'll let others crease out the bugs while i pump out more crappy apps in eclipse. i'll give it another go before the end of this year.
    This.


  • Registered Users, Registered Users 2 Posts: 2,021 ✭✭✭ChRoMe



    i know it's the future though, but i'll let others crease out the bugs while i pump out more crappy apps in eclipse. i'll give it another go before the end of this year.

    Or just use IntelliJ and ditch the steaming pile of **** that eclipse is.


  • Advertisement
Advertisement