diff --git a/.github/workflows/android-beta.yaml b/.github/workflows/android-beta.yaml index 82674b6b4b..d8800ca0d9 100644 --- a/.github/workflows/android-beta.yaml +++ b/.github/workflows/android-beta.yaml @@ -40,7 +40,7 @@ jobs: - name: Set up SDK shell: bash run: | - (cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT --ndk $ANDROID_NDK_ROOT) + (cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT) - name: Compile shell: bash diff --git a/.github/workflows/android-check.yaml b/.github/workflows/android-check.yaml index 1db84802e1..88b1b5768d 100644 --- a/.github/workflows/android-check.yaml +++ b/.github/workflows/android-check.yaml @@ -25,7 +25,7 @@ jobs: - name: Set up SDK shell: bash run: | - (cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT --ndk $ANDROID_NDK_ROOT) + (cd tools/android; ./set_up_android.py --sdk $ANDROID_SDK_ROOT) - name: Compile shell: bash diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 6ac0aa43dd..193fb9b630 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -177,9 +177,10 @@ Configure the repository for the debug mode: Set Android SDK and NDK path: ```bash -./tools/android/set_up_android.py \ - --sdk $HOME/Android/Sdk \ - --ndk $HOME/Android/Sdk/ndk/22.0.7026061/ # Update for the actual NDK version +# Linux +./tools/android/set_up_android.py --sdk $HOME/Android/Sdk +# MacOS +./tools/android/set_up_android.py --sdk $HOME/Library/Android/Sdk ``` ### Building diff --git a/tools/android/set_up_android.py b/tools/android/set_up_android.py index 6b70cfd9b2..259ec8a130 100755 --- a/tools/android/set_up_android.py +++ b/tools/android/set_up_android.py @@ -29,16 +29,13 @@ def read_local_properties(): androidRoot = os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'android') propsFile = os.path.join(androidRoot, 'local.properties') sdkDir = None - ndkDir = None if os.path.exists(propsFile): with open(propsFile, 'r') as f: for line in f: line = line.strip() if line.startswith('sdk.dir') and '=' in line: sdkDir = line.split('=')[1].strip() - elif line.startswith('ndk.dir') and '=' in line: - ndkDir = line.split('=')[1].strip() - return (sdkDir, ndkDir) + return sdkDir def query_path(title, option, default, subpath): default = '' if not default else os.path.abspath(default) @@ -59,12 +56,11 @@ def query_path(title, option, default, subpath): print('Could not find {0}, not an {1} path.'.format(test, title)) sys.exit(1) -def write_local_properties(sdkDir, ndkDir): +def write_local_properties(sdkDir): content = ''.join([x + '\n' for x in [ '# Autogenerated file', '# Do not add it to version control', 'sdk.dir={0}'.format(sdkDir), - 'ndk.dir={0}'.format(ndkDir) ]]) # Create omim/android/local.properties @@ -86,19 +82,14 @@ def write_local_properties(sdkDir, ndkDir): if __name__ == '__main__': parser = OptionParser() parser.add_option('-s', '--sdk', help='Path to Android SDK') - parser.add_option('-n', '--ndk', help='Path to Android NDK') options, _ = parser.parse_args() sdkDir = options.sdk - ndkDir = options.ndk - if not options.sdk or not options.ndk: - sdkDirOld, ndkDirOld = read_local_properties() + if not options.sdk: + sdkDirOld = read_local_properties() if not sdkDir: sdkDir = sdkDirOld - if not ndkDir: - ndkDir = ndkDirOld sdkDir = query_path('Android SDK', options.sdk, sdkDir, ['platform-tools', 'adb']) - ndkDir = query_path('Android NDK', options.ndk, ndkDir, ['ndk-build']) - write_local_properties(sdkDir, ndkDir) + write_local_properties(sdkDir)