[android-developers] Re: Reusable code organization with Android Studio

2015-01-23 Thread Grunthos
Interesting post, I find myself in a similar posiion re libraries and, more 
generally, in trying to find realistic "best practice" guides.

On Saturday, January 24, 2015 at 5:07:58 AM UTC+11, Nobu Games wrote:
>
>
>- *I use only a single massive repository *that is basically an 
>Android Studio project that hosts all my Android app modules and custom 
>library modules
>   - This is not going to happen
>   
> I agree.


>- I keep app projects in separate repositories and *I import my custom 
>library modules*
>   - 
> *Importing a module creates a copy of the original *
>   - This means *redundancy* and *code synchronization issues*. I may 
>   forget to merge back changes I've done to one of the library modules
>   - Unfortunately this is the "official" solution provided by the 
>   IntelliJ IDEA documentation 
>   
> 
>
>
Is this really so bad, or am I missing something? 

In eclipse I import library projects in their own tree and make changes 
relating to different projects in different trees. When I view one set of 
changes is valid/correct/complete, I comit them and import them into my 
other projects and fix/check/pray as appropriate. I view it as much the 
same process as incorporating patches from other people. I *assume* this 
what the IntelliJ approach is...please correct me if I am wrong!

 

>
>- I keep app projects in separate repositories and *check out my 
>library modules from a separate repository as a Git submodule 
>*
>   - I *cannot cherry-pick the needed library modules* from the Git 
>   repository. Git submodule checks out the whole library repository
>   - It does not play nicely with that one level deep project/module 
>   directory structure for Android Studio projects
>
>
I've never been very fond of the git submodule approach, so yes: I agree. 
In Eclipse when I use a library I typically create tags in case I need to 
restore the exact version as built.
 

>
>- I set up a *Maven repository for my library modules* and add the 
>needed modules as dependencies to my app project
>   - Very elegant, but...
>   - Every single tiny change in my library code requires rebuilding 
>   and deploying the module.
>   - I also fear that I need to increase the version code / build 
>   number every single time so the local Maven cache gets updated? I have 
> no 
>   experience with this. :-/
>   
> Dunno. Don't know Maven, sadly.
 

>
>- 
>   
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Library Project No Class Def Error (Eclipse)

2015-01-23 Thread Jonathan S
What is com.dsi.client.lib.UniMagII for?

On Friday, January 23, 2015 at 3:13:30 PM UTC-5, pdm-tex wrote:
>
> I have an Android library project that is giving me a problem. To test it 
> I have a client application.  If I add the library project in the Android 
> settings my client application runs fine.  To test the library I remove the 
> setting for the library in the Android properties page. If I take the jar 
> file that is created in the library's bin directory and add it to the 
> clients lib directory. I would think it would run.  Instead, I am getting a 
> NoClassDefFoundError.
> The client is able to instantiate one class from the library.  The called 
> method inside the library is where the No Class Def shows up.
>
> I have to disclose that this was working and I had been able to even use 
> obfuscated versions of my library.  I cannot imagine what I might have 
> changed, but if you know of any subtle path setting or something please let 
> me know.  I am attaching a stack trace.  the library classes are all in 
> com.dsi.client.lib, the test is com.dsi.winwardsample.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Library Project No Class Def Error (Eclipse)

2015-01-23 Thread pdm-tex
I have an Android library project that is giving me a problem. To test it I 
have a client application.  If I add the library project in the Android 
settings my client application runs fine.  To test the library I remove the 
setting for the library in the Android properties page. If I take the jar 
file that is created in the library's bin directory and add it to the 
clients lib directory. I would think it would run.  Instead, I am getting a 
NoClassDefFoundError.
The client is able to instantiate one class from the library.  The called 
method inside the library is where the No Class Def shows up.

I have to disclose that this was working and I had been able to even use 
obfuscated versions of my library.  I cannot imagine what I might have 
changed, but if you know of any subtle path setting or something please let 
me know.  I am attaching a stack trace.  the library classes are all in 
com.dsi.client.lib, the test is com.dsi.winwardsample.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
01-23 14:42:07.381: E/AndroidRuntime(21462): FATAL EXCEPTION: Librarian
01-23 14:42:07.381: E/AndroidRuntime(21462): java.lang.RuntimeException: An 
error occured while executing doInBackground()
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
android.os.AsyncTask$3.done(AsyncTask.java:299)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.util.concurrent.FutureTask.setException(FutureTask.java:219)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.util.concurrent.FutureTask.run(FutureTask.java:239)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.lang.Thread.run(Thread.java:856)
01-23 14:42:07.381: E/AndroidRuntime(21462): Caused by: 
java.lang.NoClassDefFoundError: com.dsi.client.lib.UniMagII
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
com.dsi.client.lib.ClientActivity.processTransaction(ClientActivity.java:139)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
com.dsi.winwardsample.WWActivity$Librarian.doInBackground(WWActivity.java:71)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
com.dsi.winwardsample.WWActivity$Librarian.doInBackground(WWActivity.java:1)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
android.os.AsyncTask$2.call(AsyncTask.java:287)
01-23 14:42:07.381: E/AndroidRuntime(21462):at 
java.util.concurrent.FutureTask.run(FutureTask.java:234)


[android-developers] Reusable code organization with Android Studio

2015-01-23 Thread Nobu Games
I've been pulling out my hair over this in the past two days and searched 
the Internet for best practices when it comes to organizing reusable code 
in an Android Studio project. Coming from an Eclipse development background 
it's not really all that intuitive to understand. This post is a bit 
longer, so bear with me.

*TL;DR:* *What's your best practice when it comes to module organization 
and version control?*

The way I organized code so far using Eclipse for development and Apache 
Ant for building projects allowed me to easily keep the app project 
separate from its library projects. They could reside in different 
directories that belong to different version control system repositories. 
Now with Android Studio and my limited understanding of Gradle and the new 
build process I am basically forced to have all so-called library 
*"modules"* arranged as sub-directories of the main app project directory. 
In terms of code organization I have the following options:

   - *I use only a single massive repository *that is basically an Android 
   Studio project that hosts all my Android app modules and custom library 
   modules
  - This is not going to happen
  - I keep app projects in separate repositories and *I import my 
   custom library modules*
  - 
*Importing a module creates a copy of the original *
  - This means *redundancy* and *code synchronization issues*. I may 
  forget to merge back changes I've done to one of the library modules
  - Unfortunately this is the "official" solution provided by the 
  IntelliJ IDEA documentation 
  

  - I keep app projects in separate repositories and *check out my 
   library modules from a separate repository as a Git submodule 
   *
  - I *cannot cherry-pick the needed library modules* from the Git 
  repository. Git submodule checks out the whole library repository
  - It does not play nicely with that one level deep project/module 
  directory structure for Android Studio projects
   - I set up a *Maven repository for my library modules* and add the 
   needed modules as dependencies to my app project
  - Very elegant, but...
  - Every single tiny change in my library code requires rebuilding and 
  deploying the module.
  - I also fear that I need to increase the version code / build number 
  every single time so the local Maven cache gets updated? I have no 
  experience with this. :-/
  
*Here is what I am currently doing* and I'm not sure if it's good enough or 
can be considered a best practice:

This is my directory structure for app projects:
\ projects
\ my-android-libs   (checked out from library modules repository)
\ module-1
\ module-2
\ ...
\ App-1 (checked out from App-1 repository)
\ app
\ ...
\ App-2 (checked out from App-2 repository)
\ app
\ ...

As suggested in this post , in 
any of those app projects I need to alter the settings.gradle file and add 
the desired module dependency like this:

include ':app'
include ':module-1'

project(':module-1').projectDir = new File(settingsDir, 
'../my-android-libs/module-1)

Then I also need to add to the app module's build.gradle file a "compile 
project" statement to the dependencies list:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':module-1')
}

This workaround works so far and right now it's the "lesser evil" for me. 
However, I'm still totally new to Android Studio, Gradle and Maven and I'd 
like to hear if you guys know some best practices when it comes to module 
organization, project setup and version control. I'm especially interested 
if anyone of you goes with the private Maven repository solution and how 
that works for you.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Android UI Design resources?

2015-01-23 Thread Jose_GD
I recall the following people writing good blog posts about Android UI:
- Mark Allison
- Cyril Mottier
(don't remember their sites, I follow them on Twitter and they post there 
links to their blog posts)

Also I recommend suscribing to Android Weekly, it has a lot of amazing 
Android stuff every Sunday, obviously with many UI design tips

HTH,

José
https://play.google.com/store/apps/developer?id=Jos%C3%A9+Gonz%C3%A1lez+D%27Amico

El viernes, 23 de enero de 2015, 1:06:11 (UTC-3), Joe Seeley escribió:
>
> I'm easily able to find programming resources for Android, but not so much 
> on UI design.  I have looked through most of the official Google stuff 
> http://developer.android.com/guide/topics/ui/index.html, but haven't seen 
> much beyond that.
>
> Are there any really good books or blogs in this area?  I would really 
> like something that uses a good design by example and gets into more 
> advanced UI development; advanced list views, composing fragments, etc... 
> into a well polished design.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.