{{indexmenu_n>10}}
====== VIM4 Download Android Source Code ======
===== Introduction =====
This document mainly introduces how to download the Android source code of VIM4.
===== Get Source Code =====
Install git-lfs tool to download Android 11.0 SDK
```shell
$ sudo apt install git-lfs
```
1) Create an empty directory to store working files:
```shell
$ mkdir -p WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
```
2) Run ''repo init'' to download the manifest repository first:
```shell
$ repo init -u https://github.com/khadas/android_manifest.git -b khadas-vim4-r-64bit
```
3) Run ''repo sync'' to pull down the Android Source branch:
```shell
$ repo sync -j4
```
It will take approx one hour to complete the initial sync operation.
If ''repo sync'' operation failed, you need to run the command repeatly; or you can try with this script:
```shell
#!/bin/bash
repo sync -j4
while [ $? = 1 ]; do
echo "Sync failed, repeat again:"
repo sync -j4
done
```
**If needed, press Ctrl-\ to quit.**
4) Go to the following directory and execute the ''git lfs pull'' command to pull large files. Otherwise, compilation will report an [[https://forum.khadas.com/t/cannot-build-an-android/15886|error]].
```shell
vendor/amlogic/common
device/khadas
device/khadas/kvim4-kernel
```
```shell
/users/vim4_code$ cd vendor/amlogic/common
/users/vim4_code/vendor/amlogic/common$ git lfs pull
Git LFS: (6 of 6 files) 239.31 MB / 239.31 MB
/users/vim4_code/vendor/amlogic/common$ cd -
/users/vim4_code
/users/vim4_code$ cd device/khadas/
/users/vim4_code/device/khadas$
/users/vim4_code/device/khadas$ git lfs pull
Git LFS: (2 of 2 files) 231.89 MB / 231.89 MB
/users/vim4_code/device/khadas$
/users/vim4_code/device/khadas$ cd kvim4-kernel/
/users/vim4_code/device/khadas/kvim4-kernel$
/users/vim4_code/device/khadas/kvim4-kernel$ git lfs pull
Git LFS: (4 of 4 files) 451.79 MB / 451.79 MB
```
5) Begin a new branch for development:
```shell
$ repo start --all
```
===== Further Reading =====
* [[https://source.android.com/source/downloading.html|Android Official Documents]]
* [[products:sbc:vim4:development:android:build-android|Build Android]]