Skip to content

Commit

Permalink
Android build fix and update (navit-gps#827)
Browse files Browse the repository at this point in the history
  • Loading branch information
jandegr authored and pgrandin committed Aug 16, 2019
1 parent ab4d808 commit c2f9838
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 20 deletions.
11 changes: 8 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
build_android:
working_directory: ~/code
docker:
- image: circleci/android:api-28-ndk
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
Expand All @@ -78,13 +78,18 @@ jobs:
name: Id
command: cat /etc/*release
- run:
name: Install cmake gettext libsaxonb-java librsvg2-bin pkg-config libprotobuf-c-dev protobuf-c-compiler
name: Install cmake gettext libsaxonb-java librsvg2-bin pkg-config rename
command: |
sudo apt-get update
sudo apt-get install -y cmake gettext libsaxonb-java librsvg2-bin pkg-config libprotobuf-c-dev protobuf-c-compiler
sudo apt-get install -y cmake gettext libsaxonb-java librsvg2-bin pkg-config rename
- run:
name: Install Android SDK components
command: sdkmanager "cmake;3.6.4111459"
- run:
name: Install ndk
command: |
echo y | sdkmanager --licenses
echo y | sdkmanager ndk-bundle
- run:
name: Build for Android
command: bash scripts/build_android.sh
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip
11 changes: 5 additions & 6 deletions navit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,12 @@ if(NOT ANDROID)
endif()
endif()

#if (SHARED_LIBNAVIT)
# add_library (${NAVIT_LIBNAME} SHARED ${NAVIT_SRC} )
#else(SHARED_LIBNAVIT)
# add_library (${NAVIT_LIBNAME} STATIC ${NAVIT_SRC} )
#endif(SHARED_LIBNAVIT)
if (SHARED_LIBNAVIT)
add_library (${NAVIT_LIBNAME} SHARED ${NAVIT_SRC} )
else(SHARED_LIBNAVIT)
add_library (${NAVIT_LIBNAME} STATIC ${NAVIT_SRC} )
endif(SHARED_LIBNAVIT)

add_library (${NAVIT_LIBNAME} ${NAVIT_SRC} )
if(NOT MSVC)
SET(NAVIT_LIBS ${NAVIT_LIBS} m)
endif(NOT MSVC)
Expand Down
14 changes: 7 additions & 7 deletions navit/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ apply from: "$project.rootDir/gradle/scripts/git-scm-version.gradle"
apply plugin: 'checkstyle'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "org.navitproject.navit"
minSdkVersion 9
targetSdkVersion 27
targetSdkVersion 28
versionCode gitVersionCode
versionName gitVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk { // need for now for 'x86_64' and , 'armeabi' and , 'arm64-v8a'
abiFilters 'x86', 'armeabi-v7a'
ndk { // need for now for 'x86_64' and 'armeabi'
abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
}
externalNativeBuild {
cmake {
Expand Down Expand Up @@ -61,10 +61,10 @@ android {
xml.enabled = true
html.enabled = true
xml {
destination "checkstyle/checkstyleMain.xml"
destination file("checkstyle/checkstyleMain.xml")
}
html {
destination "checkstyle/checkstyleMain.html"
destination file("checkstyle/checkstyleMain.html")
}
}

Expand Down
2 changes: 1 addition & 1 deletion navit/android/src/org/navitproject/navit/Navit.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public void onCreate(Bundle savedInstanceState) {
ActivityResults = new NavitActivityResult[16];
setVolumeControlStream(AudioManager.STREAM_MUSIC);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"NavitDoNotDimScreen");
wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"navit:DoNotDimScreen");

if (!extractRes(langc, NAVIT_DATA_DIR + "/locale/" + langc + "/LC_MESSAGES/navit.mo")) {
Log.e(TAG, "Failed to extract language resource " + langc);
Expand Down
9 changes: 8 additions & 1 deletion scripts/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin
export JVM_OPTS="-Xmx3200m"
export GRADLE_OPTS='-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'

# processing xml is messed up a bit after the original introduction of gradle
# so a useless install of ant here even if using gradle/ninja

sudo apt-get install -y ant

echo Run CMake
cmake ./ -Dvehicle/gpsd_dbus:BOOL=FALSE -Dsvg2png_scaling:STRING=-1,24,32,48,64,96,128,192,256 -Dsvg2png_scaling_nav:STRING=-1,24,32,48,64,96,128,192,256 -Dsvg2png_scaling_flag:STRING=-1,24,32,64,96 -DUSE_PLUGINS=n -DBUILD_MAPTOOL=n -DXSL_PROCESSING=y -DXSLTS=android -DANDROID=y -DSAMPLE_MAP=n || exit 1
cmake ./ -Dvehicle/gpsd_dbus:BOOL=FALSE -Dsvg2png_scaling:STRING=-1,24,32,48,64,96,128,192,256 -Dsvg2png_scaling_nav:STRING=-1,24,32,48,64,96,128,192,256 -Dsvg2png_scaling_flag:STRING=-1,24,32,64,96 -DXSL_PROCESSING=y -DXSLTS=android -DANDROID=y || exit 1

echo Process icons
pushd navit/icons
Expand All @@ -45,6 +50,8 @@ rename 'y/A-Z/a-z/' ./*.mo
popd
popd



echo Process xml config files
make navit_config_xml || exit 96
pushd navit
Expand Down

0 comments on commit c2f9838

Please sign in to comment.