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

Android Studio integration #5855

Closed
Closed

Description

@kkaefer

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

Activity

  1. added
    Android
    on Aug 3, 2016
  2. jfirebaugh commented on Mar 28, 2017

    @jfirebaugh
    Contributor

    Landed in #8363.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidbuild

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions