repo: command not found? - android

I am new to git and repo. I am in window 7 so I use cygwin. I have installed git from cygwin setup. After that I try to repo with the following command in cygwin.
$ repo init-u git://android.git.kernel.org/platform/manifest.git
I get an error like these:
bash: repo: command not found
I think I need to setup cygwin for repo. What do I need next to get repo?

Case 1: Not installed google repo yet?
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Use the following checksums when required:
For version 1.25 it is
d06f33115aea44e583c8669375b35aad397176a411de3461897444d247b6c220
For version 1.26, it is 0cf5f52bcafb8e1d3ba0271b087312f6117b824af272bedd4ee969d52363a86b
Case 2: Already have google repo Installed, still wondering what went wrong ?
Add
PATH=~/bin:$PATH to the end of file ~/.bashrc
and then run
source ~/.bashrc

You still need to install repo. repo is a third party tool built on top of git. See:
http://source.android.com/source/downloading.html
for how to install

I have the same problem and I have to do:
$ PATH=~/bin:$PATH every time I repo sync but at least it works.

add line
export PATH=~/bin:$PATH in file ~/.bashrc

edit .bash_profile and uncomment these fields. (any text editor will do)
# Set PATH so it includes user's private bin if it exists
# if [ -d "${HOME}/bin" ] ; then
# PATH="${HOME}/bin:${PATH}"
# fi
Restart CYGWIN.

Check and see if you have both .profile & .bash_profile in the working directory.
If you do, it's possible that the export command in both is actually conflicting in your shell. Making the output look something like this in Windows...
PATH="C:/Windows/path/to/repo/Windows/path/to/repo:$PATH"
export PATH
That's what happened to my bash shell anyway. It is correct that the 2 files interact with Bash or Cygwin differently, however if you have redundant inputs, they will compile together...

This answer for android build system error
For Python 3
If you get a "/usr/bin/env 'python' no such file or directory" error message, use one of the following solutions:
If your Ubuntu 20.04.2 LTS is a newly installed (vs. upgraded) Linux version:
sudo ln -s /usr/bin/python3 /usr/bin/python
f using Git version 2.19 or greater, you can specify --partial-clone when performing repo init. This makes use of Git's partial clone capability to only download Git objects when needed, instead of downloading everything. Because using partial clones means that many operations must communicate with the server, use the following if you're a developer and you're using a network with low latency:
repo init -u https://android.googlesource.com/platform/manifest -b master --partial-clone --clone-filter=blob:limit=10M
you can see document in
Downloading the Source

Related

Stock Android OS downloading [AOSP] and sync issue

I have started my AOSP download with lot of hiccups.
I followed the google official site instructions.
$ mkdir ~/aosp/bin
$ PATH=~/aosp/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/aosp/bin/repo
$ chmod a+x ~/aosp/bin/repo
$ mkdir zero
$ cd zero
$ git config --global user.name "Your Name"
$ git config --global user.email "you#example.com
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r1
$ repo sync -j2 -f
As of now my .repo folder is 40GB and sync is still on its been 2 days. Please can anybody help me, all I need is KitKat OS.
Also could anyone enlighten me about project-object and project directories in repo directory.
Thanks in advance
When you do:
repo sync -j2 -f
You are synchronizing everything, which is huge. Give this a try:
repo sync -j8 -c
This will only synch the initialized manifest, which is not as big. When you don't specify a manifest name with -m option, if falls to look for default.xml, which as I can see in https://android.googlesource.com/platform/manifest/+/refs/heads/android-4.4.2_r1 that's the manifest file for the branch you want.
Also -j specifies the threads used, nowadays you can give -j8 at least a try.
With -f you force the download, this does not affect on the size of what you download, nor the speed. You can drop it if desired.
Hope it helps!
After a week's struggle completed the repo sync of KITKAT OS from google. even though you select only a particular OS, It will go upto 58 GB. Out of that 58 GB your KITKAT OS will be only of 9.5 GB. Rest is your .repo in your WORKING DIRECTORY. After sync is complete you will find your OS source in your WORKING DIRECTORY along side .repo.
STEPS:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ git config --global user.name "Your Name"
$ git config --global user.email "you#example.com"
$ repo init -u https://android.googlesource.com/platform/manifest -b OS version
check with google's "source code tags and build" page to select your OS version.
$ repo sync -j18 -c
flags that can be used with repo sync
sync-j - The value for this will be the number of threads to use when syncing the system. Parallelization helps get the job done quicker, but could also get the computer or the network stuck. Using 4 threads is what commonly used for syncing.
sync-c - syncing only the current branch/tag from git. This will checkout for each project only the current branch/tag that we specify for it, and not any other branches that exists on the repository. This will help save some space and bandwidth (and also time), but if you’ll need to switch between branches on a specific project later on - you’ll need to fetch it manually.
it took 8 days for me to get this done as my internet speed is slow (100kbps).
Thank you #Olaia for all the help. hope this helps for anyone out there.

repo: command not found in automated bash script to build cyanogenmod

I am running linux mint 17.2, I have repo installed and the path to repo is added to my .bashrc. I have previously initiated my repo.
I have followed the instructions on the Android Source Downloading and How to Build CyanogenMod pages.
The problem is: I have written a bash script to automate a number of the commands I would like to use to start a build. My script in a simple form is the following:
#!/bin/bash
cd ~/Android/Cyanogenmod/cm12_1/android/system
source build/envsetup.sh
repo sync --force-sync -j8
exec $SHELL
When I run this, it reports:
/home/username/Desktop/Cyanogenmod_cm12_1_Grouper_Build : line 4 repo: command not found
If I copy and paste each line into a fresh terminal instance (or by just running a script of #!/bin/bash exec $SHELL to open a terminal) it works perfectly.
What I have tried: I have tried including a sleep 10 before the repo sync --force-sync -j8 but that made no difference. I have also tried explicitly initiating the repo and force adding it to my PATH for the current terminal session directly before attempting the repo sync --force-sync -j8. The code for that test was the following:
#!/bin/bash
mkdir -p ~/Android/Cyanogenmod/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/Android/Cyanogenmod/bin/repo
chmod a+x ~/Android/Cyanogenmod/bin/repo
cd ~/Android/Cyanogenmod/cm12_1/android/system/
source build/envsetup.sh
PATH=~/Android/Cyanogenmod/bin/repo:$PATH
repo sync --force-sync -j8
exec $SHELL
The following 2 questions have a similar title, but neither are my question, this and this.
Any help or suggestions would be great, thank you!
To summarize, there turned out to be 2 problems. The first, was in my attempted solution of manually setting the path in the script as PATH=~/Android/Cyanogenmod/bin/repo:$PATH should have been just PATH=~/Android/Cyanogenmod/bin:$PATH.
The second, and overall larger problem, was an incorrectly added PATH variable (to repo) in my .bashrc. This was fixed by adding the line export PATH=$PATH:$HOME/Android/Cyanogenmod/bin to the end of my .profile, followed by logging out/in.

How to download only a working directory of the AOSP source code without the entire repo history?

The size of the latest AOSP source code is rather large (around 30-35 Gb for the .repo directory and another 15 Gb or so for the working directory). Is there a way to download only a snapshot of the latest version of the source code (official marshmallow release) without the entire repo history? That would save me a lot in bandwidth and storage.
You can specify --depth 1 to git clone command. It will only get the latest snapshot.
Step to download android source code(AOSP) in Ubuntu
First create one folder like "aosp-m" to copy AOSP code in your machine.
Open terminal(Ctrl+Alt+T) and change your Dir to latest created Dir let say "aosp-m"
After that Run the following command in terminal :-
git clone git://gitz01/cm/download/android/manifest
if this link not work then try this one
repo init -u https://android.googlesource.com/platform/manifest
Run Following command in terminal one by one
git config --global user.name "Your Name"
git config --global user.email "you#example.com"
then run following command for repo init
repo init -u git://gitz01/cm/download/android/manifest -b master -m identifiedmanifest.xml
if this link not work then try this one
repo init --depth=1 -u https://android.googlesource.com/platform/manifest -b identifiedmanifest.xml
here you can replace identifiedmanifest.xml to your desired AOSP source code , Let Say "android-6.0.1_r10.xml" marshmellow.
and in the last run "repo sync" command. This command start downloading your desired AOSP code in your machine. This opertation take more than 1 hours(depending on your internet connection speed) to download source code.
Thats it... Happy Coding.......
Since git version 2.19 (released in 2018), we can utilize git's --partial-clone flag via the repo tool like the following:
repo init -u https://android.googlesource.com/platform/manifest -b master --partial-clone --clone-filter=blob:limit=10M
For readers of this question and answer in 2020, be warned that the AOSP repositories have gotten bigger and the above command still results in around 73 gigabytes of source code and related files.

Build PDFium in Android

I am facing a problem. I have to add a PDF reader support to my Android App (now I'm using Mupdf but I need to change it).
I found PDFium project (https://code.google.com/p/pdfium/) and I think it is what I need for my needs.
I haven't too much experience in Android and I've not been able to build it for Android, I've followed the build instructions from here https://code.google.com/p/pdfium/wiki/Build with no good results.
Could you give some hint or advice to achieve build this tool in Android?
Thank you in advance!!!
How to build?
I recommend building on Linux (virtual machine will suffice),
because Windows is officially not supported and there are many problems on newer versions of OS X.
You will need about 60 GB of free space.
install OpenJDK 8
$ mkdir ~/android_src && cd ~/android_src or select any other path
$ repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r28
(detailed description available here)
$ repo sync and wait...
clone this repo (or download zip with its content)
replace makefiles in ~/android_src with corresponding makefiles from this repo
$ cd ~/android_src
$ source build/envsetup.sh
$ cd external/pdfium/fpdfsdk
$ lunch and select architecture
$ mma and wait ~5 minutes
library is available in ~/android_src/out/target/product/generic*/obj/lib/libmod*.so, copy it somewhere
$ rm -r ~/android_src/out before next build
It worked for me, but if doesn't work for you, try installing additional packages listed here.
Source
Build it within the AOSP
https://android.googlesource.com/platform/external/pdfium/
Use mm or mma instructions to build only the pdfium module
I've only successfully built the shared library but haven't take it into practice.

Android Source, Git/Repo and error: '.../.repo/repo/.git/clone.bundle' does not look like a v2 bundle file

I'm having problems updating my Android source tree on Mac OS X (10.7.3), x64 Intel. The code was installed per Downloading the Source Tree, and SE Android was applied per How do I get the SE Android code?.
According to Version Control with Repo and Git, I issued repo sync, which resulted in:
error: '.../.repo/repo/.git/clone.bundle' does not look like a v2 bundle file
I also tried to use git pull, which resulted in:
fatal: Not a git repository (or any of the parent directories): .git
Both commands were executed from the root of the source tree.
Any ideas?
Jeff
I got the same error too.
You might want to try getting the repo again and retrying.
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
There could be problems with checksums, which is probably why pulling the latest repo helps.
Redo repo init and repo sync.

Categories

Resources