# Build from source
## Install gradlew   
  See https://gradle.org/install#with-a-package-manager
## Build Weex   
run `./gradlew clean assembleRelease` to build `weex_sdk`

### Build Types
For historical reason, the java files of weex_sdk was under the package name of `com.taobao.weex`, despite the fact that they are under `org.apache.weex` now.

In order to provide backward compatibility for users, there are two type of convince binary of Weex generated by different building argument.

#### weex_sdk
`weex_sdk` is the library we give officially support now, where all java files in `.aar` is under `org.apache.weex`.

New users of Weex should always choose `weex_sdk`, while for existing users, using `weex_sdk` could cause compiling issues and you could use `weex_sdk_legacy` for temporary solution. See below for detail.

#### weex_sdk_legacy
`weex_sdk_legacy`  is provided only for backward compatibility reason, and **would not be maintained in the future**. Please migrate to `weex_sdk` when you are available.

`weex_sdk_legacy` is built by `./gradlew clean assembleRelease -PapachePackageName="false"`, where all java files in `.aar` is under `com.taobao.weex`

## Android-Studio integrated
Double type `SHIFT` and enter `Build Variants`, will give you build variants window.
* Select `apacheRelease` in the dropdown window of Active Build Variants to enable Android-Studio integrated for files under `org.apache.weex`
* Select `legacyRelease` or `release` in the dropdown window of Active Build Variants to enable Android-Studio integrated for files under `com.taobao.weex`

## The submodule weex-playground
[Weex Playground](https://github.com/apache/incubator-weex-playground) can be used to test and preview weex pages on Android and it has been added as a submodule.
### Relationship between weex and playground
* The playground submodule will be cloned and updated automatically when developers clone the ‘incubator-weex’ repo and build it.In this case, playground project will implement the source code of weex-sdk.
* When developer directly clone the 'weex-playground' repo and run it separately, the playground project will implement a corresponding aar version of weex-sdk.
### When to publish SNAPSHOT
When some commits of  playground rely on unpublished features of weex-sdk,a SNAPSHOT of weex-sdk will be needed to support it.
### How to publish SNAPSHOT
 `cd android `  
`./gradlew clean install ArtifactoryPublish -PweexVersion=$PUBLISH_VERSION -PbintrayUser=alibabaweex -PbintrayApiKey=$JCENTER_TOKEN `  

* Explanation for variable:  
$PUBLISH_VERSION The version of snapshot, like 0.26.1.3-SNAPSHOT  
$JCENTER_TOKEN The private key for JCenter (https://bintray.com/alibabaweex/maven/weex_sdk/), which is the distribution channel for Android