[android-auto] Add gradle support #3892
9 changed files with 80 additions and 9 deletions
2
.github/workflows/android-check.yaml
vendored
2
.github/workflows/android-check.yaml
vendored
|
@ -54,7 +54,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [WebDebug, FdroidBeta]
|
||||
flavor: [WebNoCarDebug, WebCarDebug, FdroidNoCarBeta, FdroidCarBeta]
|
||||
|
||||
steps:
|
||||
- name: Install build tools and dependencies
|
||||
|
|
2
.github/workflows/android-monkey.yaml
vendored
2
.github/workflows/android-monkey.yaml
vendored
|
@ -73,7 +73,7 @@ jobs:
|
|||
run: |
|
||||
cmake --version
|
||||
ninja --version
|
||||
gradle -Parm64 -Parm32 -Pfirebase assembleGoogleDebug
|
||||
gradle -Parm64 -Parm32 -Pfirebase assembleGoogleNoCarDebug
|
||||
|
||||
- name: Run monkey
|
||||
run: |
|
||||
|
|
|
@ -48,6 +48,6 @@ jobs:
|
|||
|
||||
- name: Upload
|
||||
shell: bash
|
||||
run: ./gradlew publishGoogleReleaseListing
|
||||
run: ./gradlew publishGoogleNoCarReleaseListing
|
||||
working-directory: android
|
||||
timeout-minutes: 5
|
||||
|
|
8
.github/workflows/android-release.yaml
vendored
8
.github/workflows/android-release.yaml
vendored
|
@ -121,22 +121,22 @@ jobs:
|
|||
shell: bash
|
||||
working-directory: android
|
||||
run: |
|
||||
gradle bundleGoogleRelease publishGoogleReleaseBundle
|
||||
gradle bundleGoogleNoCarRelease publishGoogleNoCarReleaseBundle
|
||||
if: ${{ matrix.flavor == 'google' }}
|
||||
|
||||
- name: Compile and upload to Huawei AppGallery
|
||||
shell: bash
|
||||
working-directory: android
|
||||
run: |
|
||||
gradle bundleHuaweiRelease
|
||||
gradle publishHuaweiAppGalleryHuaweiRelease
|
||||
gradle bundleHuaweiNoCarRelease
|
||||
gradle publishHuaweiAppGalleryHuaweiNoCarRelease
|
||||
if: ${{ matrix.flavor == 'huawei' }}
|
||||
|
||||
- name: Compile universal APK
|
||||
shell: bash
|
||||
working-directory: android
|
||||
run: |
|
||||
gradle assembleWebRelease
|
||||
gradle assembleWebNoCarRelease
|
||||
if: ${{ matrix.flavor == 'web' }}
|
||||
|
||||
- name: Prepare release notes
|
||||
|
|
|
@ -232,7 +232,7 @@ android {
|
|||
res.srcDirs = ['tests/resources']
|
||||
}
|
||||
|
||||
flavorDimensions 'default'
|
||||
flavorDimensions 'default', 'car'
|
||||
|
||||
productFlavors {
|
||||
// 01 is a historical artefact, sorry.
|
||||
|
@ -268,10 +268,31 @@ android {
|
|||
buildConfigField 'String', 'REVIEW_URL', '"appmarket://details?id=app.organicmaps"'
|
||||
android.sourceSets.huawei.assets.srcDirs = ['flavors/world-enabled']
|
||||
}
|
||||
|
||||
car {
|
||||
dimension 'car'
|
||||
minSdkVersion propAndroidAutoMinSdkVersion.toInteger()
|
||||
|
||||
android.sourceSets.car {
|
||||
manifest.srcFile 'flavors/car/AndroidManifest.xml'
|
||||
java.srcDirs = ['flavors/car/src']
|
||||
res.srcDirs = ['flavors/car/res']
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.car.app:app:1.3.0-beta01'
|
||||
// Fix for app/organicmaps/util/FileUploadWorker.java:14: error: cannot access ListenableFuture
|
||||
implementation 'com.google.guava:guava:29.0-android'
|
||||
}
|
||||
}
|
||||
|
||||
noCar {
|
||||
dimension 'car'
|
||||
}
|
||||
}
|
||||
|
||||
playConfigs {
|
||||
googleRelease {
|
||||
googleNoCarRelease {
|
||||
enabled.set(true)
|
||||
}
|
||||
}
|
||||
|
|
30
android/flavors/car/AndroidManifest.xml
Normal file
30
android/flavors/car/AndroidManifest.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="androidx.car.app.ACCESS_SURFACE" />
|
||||
<uses-permission android:name="androidx.car.app.NAVIGATION_TEMPLATES" />
|
||||
|
||||
<application
|
||||
android:name=".MwmApplication"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
tools:node="merge">
|
||||
|
||||
<meta-data
|
||||
android:name="androidx.car.app.minCarApiLevel"
|
||||
android:value="1" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.car.application"
|
||||
android:resource="@xml/automotive_app_desc" />
|
||||
|
||||
<service
|
||||
android:name=".car.OMCarService"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="androidx.car.app.CarAppService" />
|
||||
<category android:name="androidx.car.app.category.NAVIGATION" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
4
android/flavors/car/res/xml/automotive_app_desc.xml
Normal file
4
android/flavors/car/res/xml/automotive_app_desc.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<automotiveApp>
|
||||
<uses name="template" />
|
||||
</automotiveApp>
|
|
@ -0,0 +1,15 @@
|
|||
package app.organicmaps.car;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.car.app.CarAppService;
|
||||
import androidx.car.app.validation.HostValidator;
|
||||
|
||||
public final class OMCarService extends CarAppService
|
||||
{
|
||||
@NonNull
|
||||
@Override
|
||||
public HostValidator createHostValidator()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not implemented, yet");
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
propMinSdkVersion=21
|
||||
propAndroidAutoMinSdkVersion=23
|
||||
propTargetSdkVersion=33
|
||||
propCompileSdkVersion=33
|
||||
propBuildToolsVersion=33.0.0
|
||||
|
|
Reference in a new issue