Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Android Studio integration #5855

Closed
kkaefer opened this issue Aug 3, 2016 · 1 comment
Closed

Android Studio integration #5855

kkaefer opened this issue Aug 3, 2016 · 1 comment
Labels
Android Mapbox Maps SDK for Android build

Comments

@kkaefer
Copy link
Member

kkaefer commented Aug 3, 2016

Once we have #5359 in, we can start adding Android Studio support. Starting in 2.2, they support externalNativeBuild and have explicit integration for CMake.

Here's a preliminary patch:

diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle
index 38688a9..84b4a69 100644
--- a/platform/android/MapboxGLAndroidSDK/build.gradle
+++ b/platform/android/MapboxGLAndroidSDK/build.gradle
@@ -33,9 +33,20 @@ android {
     compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
     buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION

+    externalNativeBuild {
+        cmake {
+            path "../../../CMakeLists.txt"
+        }
+    }
     defaultConfig {
         minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
         targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
+        externalNativeBuild {
+            cmake {
+                arguments "-DANDROID_TOOLCHAIN=clang"
+                arguments "-DMBGL_PLATFORM=android"
+            }
+        }
     }

     sourceSets {
diff --git a/platform/android/build.gradle b/platform/android/build.gradle
index 4225752..fa9f871 100644
--- a/platform/android/build.gradle
+++ b/platform/android/build.gradle
@@ -6,7 +6,7 @@ buildscript {
         maven { url 'https://jitpack.io' }
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.1.2'
+        classpath 'com.android.tools.build:gradle:2.2.0-alpha6'
         classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'

         // NOTE: Do not place your application dependencies here; they belong

Unfortunately, the android.toolchain.cmake file they ship with does not contain support for using the libc++ STL, which we require. Ticket is at https://code.google.com/p/android/issues/detail?id=212931

@tobrun tobrun added Android Mapbox Maps SDK for Android build labels Aug 3, 2016
@jfirebaugh
Copy link
Contributor

Landed in #8363.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android build
Projects
None yet
Development

No branches or pull requests

3 participants