Update README.md for gradle

This commit is contained in:
Adam Jones 2016-06-03 10:12:35 +01:00
parent a4bcfc93f8
commit 0451819e49

View file

@ -4,71 +4,44 @@ Upload pictures from your Android phone/tablet to Wikimedia Commons.
Initially started by the Wikimedia Foundation, this app is now maintained by volunteers. Anyone is welcome to improve it, just choose among the [open issues](https://github.com/nicolas-raoul/apps-android-commons/issues) and send us a pull request :-)
## Build Requirements ##
1. [Android SDK][1] (Level 23)
2. [Maven][2]
## Build Instructions ##
1. Set the environment variable `ANDROID_HOME` to be the path to your Android SDK
2. Run `mvn install` to build
3. Run `cd commons && mvn android:deploy` to deploy to a device
**Note**: Currently uses a bunch of dependencies that are staged at `yuvi.in/blog/maven`. Will be migrated to either [Maven Central][4] or a Wikimedia staging server soon.
## Set Up IntelliJ or Android Studio for Commons Android App Development ##
## Use Android Studio or IntelliJ ##
### Import and Compile Commons Android App ##
[Download IntelliJ][6] or [Download Android Studio 1.5.2][7]. (Note: The steps below currently only work on Android Studio 1.5.2 and below)
[Download Android Studio][1] (recommended) or [IntelliJ][2].
1. Clone the repository.
2. Open IntelliJ/Android Studio. Tick the box for the Maven Integration plugin by selecting:
``File`` > ``Settings`` > ``Plugins`` > ``Maven Integration``
2. Open Android Studio/IntelliJ. Open the project:
``File`` > ``Open...``
or
(From Quick Start menu): ``Configure`` > ``Plugins`` > ``Maven Integration``
3. Import Project:
``File`` > ``Import Project``
or
(From Quick Start menu): ``Import Project (Eclipse ADT, Gradle, etc.)``
4. Navigate to the folder with the cloned repository (named apps-android-commons). Select ``OK``.
5. Select ``Import Project from external model`` > ``Maven``. Select ``Next``.
6. Tick the boxes ``Search for projects recursively`` and ``Import Maven projects automatically``. Select ``Next``.
7. Select ``Next``.
8. Select ``Next``.
9. Click ``Maven Android API 23 Platform`` or ``Android API 23 Platform`` in the sidebar. Make sure the ``Android SDK home path`` points to the ``/Android/Sdk`` folder. Make sure the ``Java SDK`` is set to 1.8 or higher.
If there are no options for the ``Java SDK``, click the ``+`` button above the sidebar and select 'JDK'. Navigate to your JDK folder, select it, and hit ``OK``, and then select the newly added JDK.
Select ``Next``.
10. Select ``Next``.
11. Select ``Finish``.
12. Set the Module SDKs.
Select the ``Dependencies`` tab on the right pane.
Set the modules as follows:
(From Quick Start menu): ``Open an existing Android Studio project``
3. Navigate to the folder in the cloned repository (named commons). Select ``OK``.
| Name | Module SDK |
|-------------------------------------------------------|---------------------------------------|
| commons | Project SDK (Android API 23 Platform) |
| commons-parent | Project SDK (Android API 23 Platform) |
| ~apklib-com.actionbarsherlock_actionbarsherlock_4.4.0 | Maven Android API 14 Platform |
| ~apklib-com.viewpagerindicator_library_2.4.1 | Maven Android API 16 Platform |
## Build Manually ##
If certain modules are not available, install the correct API levels through the SDK manager. To do this do the following:
* Click ``Cancel``. Navigate to ``File`` > ``Settings`` > ``Appearance & Behaviour`` > ``System Settings`` > ``Android SDK``.
* Tick the boxes for API levels ``14``, ``16``, and ``23`` (or Android ``4.0``, ``4.1.2`` and ``6.0``).
* Then click ``OK``, and allow it to download the new APIs. Once it has finished, click ``File`` > ``Project Structure`` > ``Project Settings`` > ``Modules``, and repeat step 15.
13. Select ``commons``. Click the green ``+`` button on the right. Select ``JARs or directories...``. Choose the ``apps-android-commons/lib`` folder. Select ``OK``.
14. Select ``OK`` to save your changes to the project structre settings.
15. To test it worked, check if it builds (Select ``commons`` on the projects panel. Select ``Build`` > ``Make Module 'commons'``). If there are no errors (warnings are OK) you're set!
Note: It is much harder to build manually. We reccomend you use Android Studio or IntelliJ IDEA, which both have gradle and all the android tools built in.
### Requirements ###
1. [Android SDK][3] (Level 23)
2. [Gradle][4]
### Build Instructions ###
1. Set the environment variable `ANDROID_HOME` to be the path to your Android SDK
2. Set the environment variable `JAVA_HOME` to the path to your Java SDK
3. Run `gradlew.bat assembleRelease` (Windows) or `./gradlew assembleRelease` (Mac / Linux) to build an unisgned apk
4. From your Android SDK's /tools directory run `adb install path/to/app.apk` (Emulator) or `adb -d install path/to/app.apk` (USB debugging)
There are more thorough instructions on the [Android Developers website][5]
## License ##
This software is licensed under the [Apache License][5].
This software is licensed under the [Apache License 2.0][6].
## Bugs ##
Please report any bug [on Github][3].
Please report any bug [on Github][7].
## Code Structure ##
@ -111,10 +84,10 @@ Captured files are not currently stored within the app, but are passed by conten
Thumbnail images are not currently cached. (?)
[1]: https://developer.android.com/sdk/index.html
[2]: https://maven.apache.org/
[3]: https://github.com/nicolas-raoul/apps-android-commons/issues
[4]: http://search.maven.org/
[5]: https://www.apache.org/licenses/LICENSE-2.0
[6]: http://www.jetbrains.com/idea/download/index.html
[7]: https://sites.google.com/a/android.com/tools/download/studio/builds/1-5-2
[1]: https://developer.android.com/studio/index.html
[2]: http://www.jetbrains.com/idea/download/index.html
[3]: https://developer.android.com/sdk/index.html
[4]: http://gradle.org/gradle-download/
[5]: https://developer.android.com/studio/build/building-cmdline.html
[6]: https://www.apache.org/licenses/LICENSE-2.0
[7]: https://github.com/nicolas-raoul/apps-android-commons/issues