couchbaselabs / GrocerySync-Android

Couchbase Lite demo app for Android: A simple synced shopping list
136 stars 66 forks source link

grocerySync creates two android icons #6

Closed sallespromanager closed 11 years ago

sallespromanager commented 11 years ago

hi,

why might we be having two android icons created when deploying the app ?

on reason would be double entries of ( below ) but that does not seem to be the case.

                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
tleyden commented 11 years ago

Yeah, I've noticed this too and it's annoying.

I can't see is being done wrong in the project.. it might be a bug with gradle / android studio. I just posted a question to the adt-dev group.

sallespromanager commented 11 years ago

Will you remove the the extraneous activity in the library ?

how could i do it ?

tleyden commented 11 years ago

Yes I did in this commit, but I haven't rebuilt it or tested yet. We need to have a CI server that pushes a snapshot build to Nexus.

In the meantime until I upload a new release .aar, you'll have to either:

sallespromanager commented 11 years ago

hi, thans again for your continuous support.

when we're building with cradle, i see .aar files in the external libraries section.

how can we turn this into statically included jars ?

can we simply include the jars instead of setting up all this repo locking us?

( despite the pain for future updates, i feel the pain now )

tleyden commented 11 years ago

The only way I can think of would be to unzip the .aar's and get the .jars out.

tleyden commented 11 years ago

Can you file a separate issue for this?

sallespromanager commented 11 years ago

i am waiting you to update the nexus repository with your commit that deleted the extra Activity so that we can get rid of the extra iCON.

but i did not really understand the third alternative you mentioned :

Or - rework your project to depend on couchbase-lite code directly using gradle dependencies

how can I do it ?

sallespromanager commented 11 years ago

hi traun, is there something I can do so we get rid of the two icons ?

tleyden commented 11 years ago

I need to verify the fix and then I can push a new version of the maven artifact. Hopefully within the next day or two.

tleyden commented 11 years ago

OK I verified the fix using the CouchChat app app.

However, rather than rebuilding the maven artifacts, I think it makes more sense if you switch over to depend directly on the Couchbase-Lite code based on these instructions This will be easier than depending on the maven artifacts, since I'll be able to push you updates more easily since you will be able to just do a git pull rather han having to wait for new maven artifacts. Note: you will also need to make sure your Couchbase-Lite code is on commit fd72dd17 or later.

Sometime in the future, we will have automated builds that push nightly "snapshot" maven artifacts to a Nexus repository, but in the meantime, I think this is the most practical way to create a tight update loop.

sallespromanager commented 11 years ago

deep breath...let's go.

i created another project in AndroidStudio, cloned the CouchBaseLite and copied res and java files from Grocery-Sync.

the compilation with ./gradlew clean && ./gradlew build is successful.

But in Android Studio, it returns a few ( 9 errors ) like shown below

/Users/rafael/AndroidStudioProjects/i1Project/i1/build/source/r/debug/com/sallespro/mobile/i1/R.java
duplicate class: com.sallespro.mobile.i1.R

/Users/rafael/Library/Caches/AndroidStudioPreview/compiler/i1project.6673299/.generated/Android_BuildConfig_Generator/i1.112124d3/production/com/sallespro/mobile/i1/BuildConfig.java
duplicate class: com.sallespro.mobile.i1.BuildConfig

I wonder that if we stick with the Grocery-Sync for a start, maybe it helps us tracking this issues and then we can move ahead to CouchChat later on.

tleyden commented 11 years ago

I haven't seen that issue .. but I might recommend restarting Android studio to try to fix it. I don't get why you are copying res/java files from Grocery-Sync?

If you have an existing Android Studio project that works and uses maven artifacts, just follow the docs to setup direct code dependencies to switch from maven artifacts to directly depending on couchbase-lite code.

sallespromanager commented 11 years ago

well,

maybe your luckier than me and when you make such changes in your projects your IDE behaves well.

I have been trying A LOT of different ways to make it work and I have had all kinds of problems with Gradle / Android Studio.

right now, if I try to create an Android project from Scratch, with no activity at all, just to setup couchbase lite, I have this error :

The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':F1'.
> Failed to notify project evaluation listener.
   > Configuration with name 'default' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.489 secs
sallespromanager commented 11 years ago

i have not really understood how to cleanly refactor a project in Android Studio. I see all kinds of problems with modules not being used anymore, questions if you want to rename the module or directory only...

what do you recommend ?

sallespromanager commented 11 years ago

By the way, i followed your instructions to setup CouchChat app and it works fine !

the problems arise when I try to either change the building procedure for an existing project ( like we are trying to do for weeks with Grocery-Sync project ) or trying to create a project from scratch.

tleyden commented 11 years ago

Good to hear!

I updated Getting Started to include instructions on how to start a project from scratch and have the project depend on the couchbase-lite code (as opposed to maven dependencies)

Android Studio has great refactoring support, not sure what you are looking for.

tleyden commented 11 years ago

That error "Configuration with name 'default' not found." is mentioned in the CouchChat README

sallespromanager commented 11 years ago

Finally, i managed to compile a project from scratch with couchbase-lite-android wich results in a single iconed app using direct code dependency.

I would like to thank you Mr. Leyden for your comprehensive support in all issues involved.

tleyden commented 11 years ago

Awesome!

sallespromanager commented 11 years ago

i sm still having a hard time though with Android Studio Modules / Project setup.

the reported error of duplicate classes has something to do with that.

http://stackoverflow.com/questions/16488892/intellij-importing-android-project-from-eclipse-leads-to-duplicate-class-error

please have a look so you can share some lessons learned with the Android Studio.

I run into this problem everytime I try to dump some new java/res files into a cleanly compiled couchbase-lite-android project.

/Users/rafael/AndroidStudioProjects/i1Project/i1/build/source/r/debug/com/sallespro/mobile/i1/R.java
duplicate class: com.sallespro.mobile.i1.R

/Users/rafael/Library/Caches/AndroidStudioPreview/compiler/i1project.6673299/.generated/Android_BuildConfig_Generator/i1.112124d3/production/com/sallespro/mobile/i1/BuildConfig.java
duplicate class: com.sallespro.mobile.i1.BuildConfig

and the strange part is that even after i rollback the original source files of the "clean" project, the error remains.. i TRIED TO SYNC FILES, RESTART aNDROID studio, kill cache, nothing seems to bring it back to the original setup.

So I have to start it all over again !!

tleyden commented 11 years ago

Hmm, interesting. I haven't run into that, but then again I haven't used the "import" feature in Android Studio very much at all. Thanks for the heads up, I'll keep my eye out for that.

sallespromanager commented 11 years ago

it's not clear what to select in this step to

Enable browsing/debugging Couchbase-Lite source code via Android Studio

Choose CouchChatAndroid-CouchChatAndroid under list of modules

we usually see two options :

  1. projectname
  2. projectnameProject

i am trying to use the first, projectname only ist it ?!

tleyden commented 11 years ago

Use projectname. I'll fix the docs.

tleyden commented 11 years ago

Updated docs to point to this page, which has a more generic description.

sallespromanager commented 11 years ago

traun, we have a problem with this whole process.

i made several attempts, and it became clear that

  1. Couchbase-lite-android asks for a MainActivity if you Enable browsing/debugging Couchbase-Lite source code via Android Studio.
  2. Eventhough you remove it afterwards, you run into the dead-end situation of duplicate class error i have been describing.
tleyden commented 11 years ago

Couchbase-lite-android asks for a MainActivity if you Enable browsing/debugging Couchbase-Lite source code via Android Studio.

Are you deleting any of the modules in that step? I briefly added that to the docs and removed it, hope you didn't get stuck on that. As long as you are just adding source content roots, this shouldn't cause any issues.

Eventhough you remove it afterwards, you run into the dead-end situation of duplicate class error i have been describing.

I've never seen that yet. I'm working on getting a screencast uploaded to youtube, will let you know once its available.

tleyden commented 11 years ago

I just uploaded a Screencast

sallespromanager commented 11 years ago

My conclusion is that as of June,26th the Android Studio & Gradle integration totally sucks !

It has been a major problem to deal with all this setup to use maven artifacts or direct source dependency.

i find you Couchbase guys brave to deliver your product in such promising / troublefull environment.

i respect your commitment to delivering detailed and constantly updated documentation, but the fact is that is has been a nightmare.

thanks again for all your support. Looking forward to a brighter Android IDE.

tleyden commented 11 years ago

Sorry to see you give up!

To be honest, I agree with you regarding all of the Android tools. I've been using XCode and iOS and the tooling feels 50X better on that platform.

The only one with any glimmer of hope of catching up is Android Studio + Gradle, which is why we're sticking with that. But yeah, it's a little rocky right now.

sallespromanager commented 11 years ago

Oh no, giving up...not me. it's just a way of getting rid of the anger of stumbling into all this rocks ...

i learned the refactoring by hard as no gradle file is updated when you rename and move stuff around.