Addressing code review comments

This commit is contained in:
Max Golovanov 2020-10-09 01:30:32 -07:00
Родитель baddb436e9
Коммит 22756e0bd5
5 изменённых файлов: 39 добавлений и 22 удалений

Просмотреть файл

@ -2,15 +2,14 @@
pushd "%~dp0"
REM Users may override the default %ANDROID_SDK_ROOT% location if necessary
if not "%ANDROID_SDK_ROOT%" == "" goto proceed
echo Set default Android SDK paths
set "ANDROID_NDK_VERSION=21.1.6352462"
set "ANDROID_CMAKE_VERSION=3.10.2.4988404"
set "ANDROID_SDK_ROOT=C:\Android\android-sdk"
set "ANDROID_HOME=%ANDROID_SDK_ROOT%"
set "ANDROID_NDK=%ANDROID_SDK_ROOT%\ndk\%ANDROID_NDK_VERSION%"
set "ANDROID_NDK_HOME=%ANDROID_NDK%"
:proceed
if "%ANDROID_SDK_ROOT%" == "" set "ANDROID_SDK_ROOT=C:\Android\android-sdk"
if "%ANDROID_NDK_VERSION%" == "" set "ANDROID_NDK_VERSION=21.1.6352462"
if "%ANDROID_CMAKE_VERSION%" == "" set "ANDROID_CMAKE_VERSION=3.10.2.4988404"
if "%ANDROID_HOME%" == "" set "ANDROID_HOME=%ANDROID_SDK_ROOT%"
if "%ANDROID_NDK%" == "" set "ANDROID_NDK=%ANDROID_SDK_ROOT%\ndk\%ANDROID_NDK_VERSION%"
if "%ANDROID_NDK_HOME%" == "" set "ANDROID_NDK_HOME=%ANDROID_NDK%"
REM Consider using %ANDROID_NDK_ROOT% environment variable
REM Install Android tools if necessary
call tools\setup-buildtools-android.cmd

Просмотреть файл

@ -17,6 +17,21 @@ The Room database implementation adds one additional initialization requirement,
If you are building on Windows, this helper script [build-android.cmd](../build-android.cmd) is provided to illustrate how to deploy the necessary SDK and NDK dependencies. Once you installed the necessary dependencies, you may use Android Studio IDE for local builds. See [ide.cmd](../lib/android_build/ide.cmd) that shows how to build the project from IDE. The `app` project (`maesdktest`) allows to build and run all SDK tests on either emulator or real Android device. While the tests are running, you can monitor the test results in logcat output.
Default environment variables used by `build-android.cmd` script:
```console
set "ANDROID_NDK_VERSION=21.1.6352462"
set "ANDROID_CMAKE_VERSION=3.10.2.4988404"
set "ANDROID_SDK_ROOT=C:\Android\android-sdk"
set "ANDROID_HOME=%ANDROID_SDK_ROOT%"
set "ANDROID_NDK=%ANDROID_SDK_ROOT%\ndk\%ANDROID_NDK_VERSION%"
set "ANDROID_NDK_HOME=%ANDROID_NDK%"
```
You can specify your own versions of dependencies as needed.
## 3. Integrate the SDK into your C++ project
If you use the lib/android_build Gradle files, they build the SDK into maesdk.aar in the output folders of the maesdk module in lib/android. You can package or consume this AAR in your applications modules, just as you would any other AAR.

Просмотреть файл

@ -6,13 +6,12 @@ for /F "usebackq skip=2 tokens=1-2*" %%A in (`reg.exe QUERY "HKLM\Software\Andro
echo Android Studio Path: %AndroidStudioPath%
set "PATH=%AndroidStudioPath%\bin;%PATH%"
if "%ANDROID_SDK_ROOT%"== "" (
echo Set default Android SDK path ...
set "ANDROID_SDK_ROOT=C:\Android\android-sdk"
set "ANDROID_HOME=%ANDROID_SDK_ROOT%"
set "ANDROID_NDK=%ANDROID_SDK_ROOT%\ndk\21.1.6352462"
set "ANDROID_NDK_HOME=%ANDROID_NDK%"
)
if "%ANDROID_SDK_ROOT%" == "" set "ANDROID_SDK_ROOT=C:\Android\android-sdk"
if "%ANDROID_HOME%" == "" set "ANDROID_HOME=%ANDROID_SDK_ROOT%"
if "%ANDROID_NDK_VERSION%"== "" set "ANDROID_NDK_VERSION=21.1.6352462"
if "%ANDROID_NDK%" == "" set "ANDROID_NDK=%ANDROID_SDK_ROOT%\ndk\%ANDROID_NDK_VERSION%"
if "%ANDROID_NDK_HOME%" == "" set "ANDROID_NDK_HOME=%ANDROID_NDK%"
where studio.bat >NUL 2>NUL
if %ERRORLEVEL% neq 0 (

Просмотреть файл

@ -1,10 +1,14 @@
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
ndkVersion "21.1.6352462"
compileSdkVersion = 29
buildToolsVersion = "29.0.3"
ndkVersion = System.getenv("ANDROID_NDK_VERSION") ?: "21.1.6352462"
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
minSdkVersion = 19
targetSdkVersion = 29
}
}

Просмотреть файл

@ -26,7 +26,7 @@ if exist ".buildtools" (
echo y | call sdkmanager.bat --include_obsolete --verbose --sdk_root=%ANDROID_SDK_ROOT% "platforms;android-29" "sources;android-29"
echo y | call sdkmanager.bat --include_obsolete --verbose --sdk_root=%ANDROID_SDK_ROOT% "build-tools;29.0.3"
echo y | call sdkmanager.bat --include_obsolete --verbose --sdk_root=%ANDROID_SDK_ROOT% "platform-tools"
echo y | call sdkmanager.bat --install --include_obsolete --verbose --sdk_root=%ANDROID_SDK_ROOT% "ndk-bundle" "cmake;3.10.2.4988404" "ndk;21.1.6352462"
echo y | call sdkmanager.bat --install --include_obsolete --verbose --sdk_root=%ANDROID_SDK_ROOT% "ndk-bundle" "cmake;%ANDROID_CMAKE_VERSION%" "ndk;%ANDROID_NDK_VERSION%"
popd
popd
copy NUL .buildtools