photo / mobile-android

Trovebox mobile application for Android
Apache License 2.0
120 stars 64 forks source link

Ant: create the apk via ant #206

Open patricksan opened 11 years ago

patricksan commented 11 years ago

Make sure the ant is working to create the app.

httpdispatch commented 11 years ago

Can you please explain more this issue? I'm using ADT wizard to create apk files.

cbhl commented 11 years ago

One should also be able to build the project from the command line using ant (similar to make, except often used with Java projects). This is useful for setting up continuous integration and/or automated builds.

As far as I can tell, it should be sufficient to just run android update project --path . in the base directory and commit the build.xml file that gets generated.

Relevant: http://stackoverflow.com/questions/4454107/how-to-convert-a-eclipse-android-project-to-use-ant-for-build http://developer.android.com/tools/projects/projects-cmdline.html#UpdatingAProject http://developer.android.com/tools/building/building-cmdline.html

jmathai commented 11 years ago

Removing the 3.0 and 3 star labels from this as it's a lower priority until it blocks development.

patricksan commented 11 years ago

@httpdispatch, we had this in the past, but some how we removed during the last months.

@jmathai, this is kind of important. I did some tests and if we generate keys to sign the package and send to Play Store, it gets mixed up when signed via ADT. I would like to have the package signed via command line. I had this problems sending builds to you.

httpdispatch commented 11 years ago

@patricksan can you point me to revision which has this feature? Is it possible that you had it only in private repo?

patricksan commented 11 years ago

@httpdispatch, I didn't find easily the revision. The build.xml can be created via this

 cd <inside the app directory>
 android update project --path .

Then we can validate if the build is being created correct and commit the .xml file

httpdispatch commented 11 years ago

During investigating this issue found that each subproject need to have build.xml file also. How will i be able to commit build.xml for th subprojects also?

httpdispatch commented 11 years ago

currently it is HE and ABS (they use maven)

patricksan commented 11 years ago

That's not a problem: http://maven.apache.org/ant-tasks/index.html

httpdispatch commented 11 years ago

do you have experience in such usage? Anyway some other submodules have custom android sdk paths and need to be updated

httpdispatch commented 11 years ago

Ok. I've managed to build project from commandline using custom keys but i had to generate build.xml for all submodules and change sdk path for them in local.properties. I will commit build.xml for Openphoto project. For other projects you can generate them like this ActionBarSherlock

"<path to adt tools>\android.bat" update project -s -t "android-16" -n "ActionBarSherlock-library" -p "..\submodules\HoloEverywhere\contrib\ActionBarSherlock\library"

HoloEverywhere

"<path to adt tools>\android.bat" update project -s -t "android-16" -n "HoloEverywhere-library" -p "..\submodules\HoloEverywhere\library"

For facebook sdk you need to copy paste local.properties from the Openphoto For the Aviary you need to replace local.properties with the Openphoto one because of different SDK path

httpdispatch commented 11 years ago

@cbhl thanks for the useful links

httpdispatch commented 11 years ago

@patricksan just found. We have build.xml and local.properties in .gitignore

httpdispatch commented 11 years ago

https://github.com/photo/mobile-android/commit/7d49ceb6e396ddbc9140bea97a50d236b3d36e7e

httpdispatch commented 11 years ago

anyway you can generate build.xml on your side

"<path to adt tools>\android.bat" update project -s -t "android-16" -n "Openphoto-App" -p .
patricksan commented 11 years ago

It is better if we commit the build.xml in the repository. Also we should be able via ant to generate the .apk file. That is what I am most interested.

httpdispatch commented 11 years ago

I can commit. But you need to generate build.xml for submodules as i described

patricksan commented 11 years ago

Can't you create a specific task in this build.xml to go to each submodule and create itself. I would like nothing manual. The script should do everything. If we have this kind of tasks will be really difficult to people execute it.

httpdispatch commented 11 years ago

I will keep searching for solution but not sure about success.

httpdispatch commented 11 years ago

What do you think about using maven instead of Ant? HE and ABS is already mavenized. Aviary we can try to mavenize. Facebook SDK we use custom fork as well as GestureImageView.

patricksan commented 11 years ago

not a problem. we can use maven. You can invoke an ant task inside maven. So for Aviary, Facebook and GestureImageView I believe we could have the default build.xml and invoke the build.

On Tue, Dec 4, 2012 at 7:22 AM, Eugene Popovich notifications@github.comwrote:

What do you think about using maven instead of Ant? HE and ABS is already mavenized. Aviary we can try to mavenize. Facebook SDK we use custom fork as well as GestureImageView.

— Reply to this email directly or view it on GitHubhttps://github.com/photo/mobile-android/issues/206#issuecomment-10985852.

httpdispatch commented 11 years ago

they don't have default build.xml or configuration should be changed for them. As for the maven it is also not easy thing.

patricksan commented 11 years ago

the ones without build.xml you could run the command to generate.

What do you mean "As for the maven it is also not easy thing." Which part?

On Tue, Dec 4, 2012 at 8:57 AM, Eugene Popovich notifications@github.comwrote:

they don't have default build.xml or configuration should be changed for them. As for the maven it is also not easy thing.

— Reply to this email directly or view it on GitHubhttps://github.com/photo/mobile-android/issues/206#issuecomment-10987494.

httpdispatch commented 11 years ago

I don't have much experience with maven. Only basics.

mcepl commented 11 years ago

Even when jumping through all the hoops with android update, I got this error on ant clean debug (using android SDK 21):

-compile:
    [javac] Compiling 126 source files to /home/matej/archiv/knihovna/repos/openphoto-android/app/bin/classes
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:326: error: cannot find symbol
    [javac]                 .setProgress(100, 0, true)
    [javac]                 ^
    [javac]   symbol:   method setProgress(int,int,boolean)
    [javac]   location: class Builder
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:353: error: cannot find symbol
    [javac]                 .build();
    [javac]                 ^
    [javac]   symbol:   method build()
    [javac]   location: class Builder
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:393: error: cannot find symbol
    [javac]             builder.setProgress(max, progress, false);
    [javac]                    ^
    [javac]   symbol:   method setProgress(int,int,boolean)
    [javac]   location: variable builder of type Builder
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:395: error: cannot find symbol
    [javac]             builder.setProgress(0, 0, true);
    [javac]                    ^
    [javac]   symbol:   method setProgress(int,int,boolean)
    [javac]   location: variable builder of type Builder
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:397: error: cannot find symbol
    [javac]         mNotificationManager.notify(NOTIFICATION_UPLOAD_PROGRESS, builder.build());
    [javac]                                                                          ^
    [javac]   symbol:   method build()
    [javac]   location: variable builder of type Builder
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:425: error: cannot find symbol
    [javac]                 .build();
    [javac]                 ^
    [javac]   symbol:   method build()
    [javac]   location: class Builder
    [javac] /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/service/UploaderService.java:476: error: cannot find symbol
    [javac]                 .build();
    [javac]                 ^
    [javac]   symbol:   method build()
    [javac]   location: class Builder
    [javac] Note: /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/PhotoDetailsActivity.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: /home/matej/archiv/knihovna/repos/openphoto-android/app/src/me/openphoto/android/app/util/concurrent/ArrayDeque.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 7 errors

BUILD FAILED
/home/matej/repos/android-sdk-linux_x86/tools/ant/build.xml:705: The following error occurred while executing this line:
/home/matej/repos/android-sdk-linux_x86/tools/ant/build.xml:718: Compile failed; see the compiler error output for details.

Total time: 31 seconds
httpdispatch commented 11 years ago

@mcepl this error is caused by outdated used android support library. Please updated it in the ABS submodule

mcepl commented 11 years ago

@httpdispatch ABS?

matej@wycliff: openphoto-android (master *%)$ git submodule update
matej@wycliff: openphoto-android (master *%)$ cat .gitmodules 
[submodule "submodules/facebook-android-sdk"]
    path = submodules/facebook-android-sdk
    url = git://github.com/photo/facebook-android-sdk.git
[submodule "submodules/HoloEverywhere"]
    path = submodules/HoloEverywhere
    url = git://github.com/ChristopheVersieux/HoloEverywhere.git
[submodule "submodules/PhotoView"]
    path = submodules/PhotoView
    url = https://github.com/chrisbanes/PhotoView.git
matej@wycliff: openphoto-android (master *%)$ ls submodules/
Android-Feather  facebook-android-sdk  HoloEverywhere  PhotoView
matej@wycliff: openphoto-android (master *%)$ 

Where’s that?

httpdispatch commented 11 years ago

@mcepl ActionBarSherlock is the nested submodule of the HoloEverywhere submodule

mcepl commented 11 years ago

I did git submodule update --recursive before trying to make a build and this is the result (ABS is at 90939dc3) and the result is still http://mcepl.fedorapeople.org/tmp/openphoto-android-build-log.txt

mcepl commented 11 years ago

Just to have the information complete:

matej@wycliff: openphoto-android (master *%)$ git submodule status --recursive
 d61634d6eb9e6126bc59b2a89e745bc23b6dd4e5 submodules/HoloEverywhere (holoeverywhere-parent-1.3.3-3-gd61634d)
 90939dc3925ffaaa0de269bbbe1b35e274968ea1 submodules/HoloEverywhere/contrib/ActionBarSherlock (4.2.0)
 18ec2058b18231b1c119effef23388b6626f6697 submodules/PhotoView (v1.2-17-g18ec205)
 d993a9e7cfd9518b40841fb25683765cec8110a0 submodules/facebook-android-sdk (v1.2.1-9-gd993a9e)
matej@wycliff: openphoto-android (master *%)$ 
httpdispatch commented 11 years ago

@mcepl All that errors are related to the outdated support v4 library included in the ABS submodule. Please update it by hand to the latest one

mcepl commented 11 years ago

a) You should do it by providing proper setting for the submodule (checked out commit in submodule is in your control), b) even when switching ABS to master, and rebuilding ABS and HoloEverywhere subsequently (which succeeds), I get the very same error. c) the error happens when compiling app/ not when in any submodule

httpdispatch commented 11 years ago

a) ABS master branch uses outdated compatibility library. We can control this only if to fork master repo b) they are not used notification api used in the uploader service which causes compile errors c) i know. We can't provide different compatibility libraries in the ABS submodule and in the application itself because it will not allow to compile

If you have any suggestion how to overcome the isse please tell.

mcepl commented 11 years ago

Nobody forces you to use top of the master branch ... submodule can point to any commit you want. It records in the commit to the superproject, which commit has been used (see e.g. output of the command git submodule status). Or am I missing something else?

httpdispatch commented 11 years ago

@mcepl we switched to HE 1.4.2 which uses latest ABS version. This version has actual compat library so compilation should not be problematic at this part anymore.

jmathai commented 11 years ago

@mcepl could you confirm and close?

mcepl commented 11 years ago

I cannot. It seems to work better, but fails later anyway ... see http://mcepl.fedorapeople.org/tmp/ant-clean-debug-log.txt for a full log of the ant clean debug running.

httpdispatch commented 11 years ago

@jmathai actually this issue is more wide than just this part. We still don't have automatic command line build from the box

patricksan commented 11 years ago

The error is related to Add Support Library in the action bar framework. We still need to work more on that.

httpdispatch commented 11 years ago

actually support library is valid from the box now. Such as latest ABS uses it.