Open rorre opened 7 years ago
I used this to add sdk & ndk paths to .bashrc: echo 'export ANDROID_HOME=/home/user/dev/android-sdk' >>/home/user/.bashrc echo 'export ANDROID_NDK_HOME=/home/user/dev/android-ndk' >>/home/user/.bashrc echo 'export ANDROID_NDK=/home/user/dev/android-ndk' >> ~/.bashrc
@Rendyindo: I have similar problem.
Using Ubuntu 16.04 LTE, cmake v3.6.3, libjansson-dev v2.9
I have the following in ENV:
env | grep android
ANDROID_HOME=/home/user/dev/android-sdk
STY=2844.android
ANDROID_NDK=/home/user/dev/android-ndk
ANDROID_NDK_HOME=/home/user/dev/android-ndk
Using cmake options:
cmake .. \
-DMBP_BUILD_TARGET=android \
-DMBP_BUILD_TYPE=debug
Also I have similar errors after make:
...
[ 14%] Built target run_devicesgen
[ 15%] Create boot UI temporary directory (x86_64)
[ 15%] Built target bootui-tempdir_x86_64
[ 17%] Performing configure step for 'android-system_x86_64'
CMake Error at cmake/android.toolchain.cmake:47 (file):
file failed to open for reading (No such file or directory):
/home/user/dev/android-ndk/source.properties
Call Stack (most recent call first):
/usr/local/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:8 (project)
CMake Error at cmake/android.toolchain.cmake:51 (message):
Failed to parse Android NDK revision:
/home/user/dev/android-ndk/source.properties.
Call Stack (most recent call first):
/usr/local/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:8 (project)
CMake Error at cmake/android.toolchain.cmake:324 (message):
Invalid Android platform: android-24.
Call Stack (most recent call first):
/usr/local/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt:8 (project)
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
android/CMakeFiles/android-system_x86_64.dir/build.make:105: recipe for target 'android/android-system_x86_64-prefix/src/android-system_x86_64-stamp/android-system_x86_64-configure' failed
make[2]: *** [android/android-system_x86_64-prefix/src/android-system_x86_64-stamp/android-system_x86_64-configure] Error 1
CMakeFiles/Makefile2:1772: recipe for target 'android/CMakeFiles/android-system_x86_64.dir/all' failed
make[1]: *** [android/CMakeFiles/android-system_x86_64.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
I also have the missing source.properties file error, but it seems you already fixed this part. How did you solve this error? I did also set ANDROID_NDK env variable, but this did not fix my case.
Maybe @chenxiaolong will give us some idea how to fix these build errors.
@Rendyindo: I think, I found the origin of the problem.
We made a mistake: we used "git clone https://android.googlesource.com/platform/ndk ~/dev/android-ndk" to get the source of NDK.
But we need to download it from this site: https://developer.android.com/ndk/downloads/index.html
Working solution is:
cd ~/dev
mkdir android-ndk
cd ~/dev/android-ndk
wget https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
unzip android-ndk-r13b-linux-x86_64.zip
echo 'export ANDROID_NDK_HOME=~/dev/android-ndk/android-ndk-r13b' >> ~/.bashrc
echo 'export ANDROID_NDK=~/dev/android-ndk/android-ndk-r13b' >> ~/.bashrc
Currently still building, far away from the problem we had.
When I had a successful build, I will post exact steps until successful build...
@Rendyindo: Let me know, if you also had successful build!
Had a successful build!
Here are the steps (not checked again from ground, take them as untested install steps):
DualBootPatcher build APK from source (debug release):
System: Ubuntu 16.04 LTS
The following packages are needed for compiling apk for Android:
Android SDK R25.2.3
Android NDK R13b
cmake 3.6.3 (at least 3.6.0)
openssl
libssl-dev
libjansson-dev (jansson, at least v2.7, maybe 2.9)
libyaml-cpp-dev (yaml-cpp)
libboost-dev
ccache
python-minimal
expect
# get required Ubuntu dependency packages
# if using Ubuntu, at least Ubuntu 16.04 LTS required (to have at least libjansson-dev v2.7)
sudo apt-get install libjansson-dev # required dependency for DualBootPatcher
# in case the libjansson-dev v2.7 still not help, download 2.9 from the following URL & install with dpkg
# https://launchpad.net/ubuntu/+archive/primary/+files/libjansson-dev_2.9-1_amd64.deb
# dpkg -i libjansson-dev_2.9-1_amd64.deb
sudo apt-get install openssl
sudo apt-get install libssl-dev # required openssl dependency for DualBootPatcher
sudo apt-get install libyaml-cpp-dev # required dependency for DualBootPatcher
sudo apt-get install libboost-dev # required dependency for libyaml-cpp-dev
sudo apt-get install ccache
sudo apt-get install python-minimal # required by Android NDK python files?
sudo apt install expect # required for sdk license question autoconfirm feature
# install cmake 3.6.3, compiled with OPENSSL support!
cd ~/dev
wget https://cmake.org/files/v3.6/cmake-3.6.3.tar.gz
tar xzf cmake-3.6.3.tar.gz
cd ~/dev/cmake-3.6.3
sudo sed -i 's|cmake_options="-DCMAKE_BOOTSTRAP=1"|cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"|' /home/user/dev/cmake-3.6.3/bootstrap
sudo ./bootstrap && sudo make && sudo make install
# get Android NDK R13b & SDK R25.2.3
cd ~/dev && mkdir android-ndk
cd ~/dev/android-ndk
# git clone https://android.googlesource.com/platform/ndk ~/dev/android-ndk
wget https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
unzip android-ndk-r13b-linux-x86_64.zip
cd ~/dev && mkdir android-sdk
cd ~/dev/android-sdk
wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
unzip tools_r25.2.3-linux.zip
# set the ENV variables
env | grep CCACHE
env | grep NDK
echo "export USE_CCACHE=1" >> ~/.bashrc
echo "export CCACHE_DIR=~/out/ccache" >> ~/.bashrc
echo 'export ANDROID_HOME=~/dev/android-sdk' >> ~/.bashrc
echo 'export ANDROID_NDK_HOME=~/dev/android-ndk/android-ndk-r13b' >> ~/.bashrc
echo 'export ANDROID_NDK=~/dev/android-ndk/android-ndk-r13b' >> ~/.bashrc
# reload bash environment
source ~/.bashrc
env | grep CCACHE
env | grep NDK
# set ccache size to 40 Gb
ccache -M 40G
# Update SDK, autoconfirm license questions
expect -c '
set timeout -1 ;
spawn ~/dev/android-sdk/tools/android update sdk --no-ui --all;
expect {
"Do you accept the license" { exp_send "y\r" ; exp_continue }
eof
}
'
# clone DualBootPatcher source here
cd ~/dev/
git clone --recursive https://github.com/chenxiaolong/DualBootPatcher.git
# Build it now
user@ubuntu16:~/dev$ cd ~/dev/DualBootPatcher && mkdir build
user@ubuntu16:~/dev/DualBootPatcher$ cd ~/dev/DualBootPatcher/build
cmake .. \
-DMBP_BUILD_TARGET=android \
-DMBP_BUILD_TYPE=debug
make
rm -rf assets && cpack -G TXZ
make apk
# RESULT APK:
~/dev/DualBootPatcher/build/Android_GUI/build/outputs/apk/Android_GUI-debug.apk
How do I use your file?
Ops, It's for TravisCI, you can remove ' - ' and use like a script :P I only made it working now, but still not build apk. https://travis-ci.org/Caio99BR/DualBootPatcher/builds/193880465 @chenxiaolong if possible can you check it, since it's like a script to user builds
@Caio99BR Here's our working travis config https://github.com/yshalsager/DualBootPatcher/blob/CI/.travis.yml
And idea how to solve this? :/ and one more thing. In documentaion, you said we need to set ANDROID_NDK_HOME, but in some of the script, we need to set ANDROID_NDK too, if we don't, that result to source.properties is missing. (is this just me, or this is a bug?)