13
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DJI Mobile SDK 2.4.1をAndroid Studio 1.5で使う方法

Last updated at Posted at 2016-01-04

DJI.jpg

DJI Mobile SDKをAndroid Studio 1.5でImport Modulesで読み込むとうまく読み込めない。

そこで、DJI Mobile SDKをAndroid Studio 1.5で使用する方法をまとめる。

新規プロジェクトの作成

Android Studio 1.5の[File]-[New]-[New Project...]を選択し、新規プロジェクトを作成する。
dji001.png

アプリケーション名とカンパニードメインを記入する。
dji002.png

Phont and TabletのMinimun SDKのVersionをしていする。DJI SDKは、API 16以降の対応となっている。
dji003.png

Activityは、Empty Activityを選択する。
dji004.png

Activity Nameを指定する。
dji005.png

新規プロジェクトが生成される。
dji006.png

新規モジュールの作成

Android Studioの[File]-[New]-[New Module...]を選択し、モジュールを生成する。
dji007.png

Moduleの種類はAndroid Libraryを選択する。
dji008.png

Android Libraryの名称とModule名を指定する。

dji009.png

新規モジュールが生成される。

dji010.png

DJI Mobile SDKをコピー

djisdklibフォルダがModule, appフォルダがメインプロジェクトになる。
dji011.png

DJI Mobile SDKをダウンロードして解凍する。Lib>DJI-SDK-LIB>Libs のファイル群を、今回新規に作成したプロジェクトのDemo>djisdklib>libs に一式コピーする。

dji022.png

dji023.png

DJI Mobile SDKのLib>DJI-SDK-Lib>res の中身も一式、新規作成したプロジェクトのdjisdklib>src>main>resにコピーする。
dji020.png

dji021.png

AndroidManifest.xmlもコピーする。

dji024.png

dji025.png

Build.gradle(Module: app)の書き換え

build.gradle (Module: app)のandroidの中に

   sourceSets {
        main {
            jni.srcDirs = []
            jniLibs.srcDir "../djisdklib/libs"
        }
    }

build.gradle (Module: app)のdependency中に

compile project(':djisdklib')

を追加。

dji014.png

build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.gclue.dji.demo"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jni.srcDirs = []
            jniLibs.srcDir "../djisdklib/libs"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile project(':djisdklib')
}

Syncをすると、プログラム上でDJI Mobile SDKが使えるようになる。

13
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?