Skip to content

Commit 7893630

Browse files
committed
update videoDecoding sample to Android SDK 4.11.
1 parent 2858580 commit 7893630

288 files changed

Lines changed: 251 additions & 50 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
The MIT License (MIT)
3-
Copyright (c) 2018 DJI
3+
Copyright (c) 2019 DJI
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This sample code demonstrates how to use [FFmpeg](https://ffmpeg.org) for video
88

99
- Android Studio 2.0+
1010
- Android System 4.2+
11-
- DJI Android SDK 4.10
11+
- DJI Android SDK 4.11
1212

1313
## IMPORTANT: Install `git lfs`
1414

android-videostreamdecodingsample/README.md

100644100755
File mode changed.

android-videostreamdecodingsample/app/build.gradle

100644100755
Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
11
apply plugin: 'com.android.application'
22

3+
repositories {
4+
mavenLocal()
5+
}
6+
37
android {
4-
compileSdkVersion 27
5-
buildToolsVersion '27.0.3'
8+
compileSdkVersion 28
9+
buildToolsVersion '28.0.3'
10+
useLibrary 'org.apache.http.legacy'
611

712
defaultConfig {
813
applicationId "com.dji.videostreamdecodingsample"
9-
minSdkVersion 19
10-
targetSdkVersion 27
14+
minSdkVersion 16
15+
targetSdkVersion 28
1116
multiDexEnabled true
1217
ndk {
1318
// On x86 devices that run Android API 23 or above, if the application is targeted with API 23 or
1419
// above, FFmpeg lib might lead to runtime crashes or warnings.
1520
abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a'
1621
}
1722
}
23+
1824
buildTypes {
1925
release {
2026
minifyEnabled false
2127
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2228
}
2329
debug {
24-
shrinkResources false
25-
minifyEnabled false
30+
shrinkResources true
31+
minifyEnabled true
2632
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2733
}
2834
}
35+
2936
sourceSets {
3037
main {
3138
jni.srcDirs=[]
3239
jniLibs.srcDirs=['../libs']
3340
}
3441
}
42+
3543
dexOptions {
3644
javaMaxHeapSize "4g"
3745
}
38-
packagingOptions{
46+
47+
packagingOptions {
3948
doNotStrip "*/*/libdjivideo.so"
4049
doNotStrip "*/*/libSDKRelativeJNI.so"
4150
doNotStrip "*/*/libFlyForbid.so"
@@ -48,22 +57,39 @@ android {
4857
doNotStrip "*/*/libDJIFlySafeCore.so"
4958
doNotStrip "*/*/libdjifs_jni.so"
5059
doNotStrip "*/*/libsfjni.so"
60+
doNotStrip "*/*/libDJICommonJNI.so"
61+
doNotStrip "*/*/libDJICSDKCommon.so"
62+
doNotStrip "*/*/libDJIUpgradeCore.so"
63+
doNotStrip "*/*/libDJIUpgradeJNI.so"
5164
exclude 'META-INF/rxjava.properties'
5265
}
66+
67+
compileOptions {
68+
sourceCompatibility JavaVersion.VERSION_1_8
69+
targetCompatibility JavaVersion.VERSION_1_8
70+
}
5371
}
54-
dependencies {
55-
implementation 'com.android.support:multidex:1.0.2'
56-
implementation('com.dji:dji-sdk:4.10', {
57-
//if your app needn't support Mavic 2 Pro and Mavic 2 Zoom, pls exclude the library-anti-distortion module
58-
//like following
59-
//exclude module: 'library-anti-distortion'
6072

61-
//Uncomment the following line if your APP does not need network RTK.
62-
//For Phantom 4 RTK and Matrice 210 RTK V2. Network RTK can be used as a virtual reference station to provide
63-
//cm level accurate position.
64-
//exclude module: 'library-networkrtk-helper'
65-
})
66-
compileOnly 'com.dji:dji-sdk-provided:4.10'
6773

68-
}
74+
dependencies {
75+
implementation 'androidx.multidex:multidex:2.0.0'
76+
implementation 'com.squareup:otto:1.3.8'
77+
implementation('com.dji:dji-sdk:4.11', {
78+
/**
79+
* Uncomment the "library-anti-distortion" if your app does not need Anti Distortion for Mavic 2 Pro and Mavic 2 Zoom.
80+
* Uncomment the "fly-safe-database" if you need database for release, or we will download it when DJISDKManager.getInstance().registerApp
81+
* is called.
82+
* Both will greatly reducing the size of the APK.
83+
*/
84+
exclude module: 'library-anti-distortion'
85+
//exclude module: 'fly-safe-database'
86+
})
87+
compileOnly 'com.dji:dji-sdk-provided:4.11'
6988

89+
implementation 'androidx.appcompat:appcompat:1.0.0'
90+
implementation 'androidx.core:core:1.0.0'
91+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
92+
implementation 'androidx.recyclerview:recyclerview:1.0.0'
93+
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01'
94+
implementation 'androidx.annotation:annotation:1.0.0'
95+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
-keepattributes Exceptions,InnerClasses,*Annotation*,Signature,EnclosingMethod
2+
3+
-dontoptimize
4+
-dontpreverify
5+
-dontwarn okio.**
6+
-dontwarn org.bouncycastle.**
7+
-dontwarn dji.**
8+
-dontwarn com.dji.**
9+
-dontwarn sun.**
10+
-dontwarn java.**
11+
-dontwarn com.amap.api.**
12+
-dontwarn com.here.**
13+
-dontwarn com.mapbox.**
14+
-dontwarn okhttp3.**
15+
-dontwarn retrofit2.**
16+
17+
-keepclassmembers enum * {
18+
public static <methods>;
19+
}
20+
21+
-keepnames class * implements java.io.Serializable
22+
-keepclassmembers class * implements java.io.Serializable {
23+
static final long serialVersionUID;
24+
private static final java.io.ObjectStreamField[] serialPersistentFields;
25+
!static !transient <fields>;
26+
private void writeObject(java.io.ObjectOutputStream);
27+
private void readObject(java.io.ObjectInputStream);
28+
java.lang.Object writeReplace();
29+
java.lang.Object readResolve();
30+
}
31+
-keep class * extends android.os.Parcelable {
32+
public static final android.os.Parcelable$Creator *;
33+
}
34+
35+
-keep,allowshrinking class * extends dji.publics.DJIUI.** {
36+
public <methods>;
37+
}
38+
39+
-keep class net.sqlcipher.** { *; }
40+
41+
-keep class net.sqlcipher.database.* { *; }
42+
43+
-keep class dji.** { *; }
44+
45+
-keep class com.dji.** { *; }
46+
47+
-keep class com.google.** { *; }
48+
49+
-keep class org.bouncycastle.** { *; }
50+
51+
-keep,allowshrinking class org.** { *; }
52+
53+
-keep class com.squareup.wire.** { *; }
54+
55+
-keep class sun.misc.Unsafe { *; }
56+
57+
-keep class com.secneo.** { *; }
58+
59+
-keep class org.greenrobot.eventbus.**{*;}
60+
61+
-keepclasseswithmembers,allowshrinking class * {
62+
native <methods>;
63+
}
64+
65+
-keep class * implements com.google.gson.TypeAdapterFactory
66+
-keep class * implements com.google.gson.JsonSerializer
67+
-keep class * implements com.google.gson.JsonDeserializer
68+
69+
-keep class androidx.appcompat.widget.SearchView { *; }
70+
71+
-keepclassmembers class * extends android.app.Service
72+
-keepclassmembers public class * extends android.view.View {
73+
void set*(***);
74+
*** get*();
75+
}
76+
-keepclassmembers class * extends android.app.Activity {
77+
public void *(android.view.View);
78+
}
79+
-keep class androidx.** { *; }
80+
-keep class android.** {*;}
81+
-keep class android.media.** { *; }
82+
-keep class okio.** { *; }
83+
-keep class com.lmax.disruptor.** {
84+
*;
85+
}
86+
87+
-dontwarn com.mapbox.services.android.location.LostLocationEngine
88+
-dontwarn com.mapbox.services.android.location.MockLocationEngine
89+
-keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
90+
<init>(...);
91+
}
92+
# ViewModel's empty constructor is considered to be unused by proguard
93+
-keepclassmembers class * extends android.arch.lifecycle.ViewModel {
94+
<init>(...);
95+
}
96+
# keep Lifecycle State and Event enums values
97+
-keepclassmembers class android.arch.lifecycle.Lifecycle$State { *; }
98+
-keepclassmembers class android.arch.lifecycle.Lifecycle$Event { *; }
99+
# keep methods annotated with @OnLifecycleEvent even if they seem to be unused
100+
# (Mostly for LiveData.LifecycleBoundObserver.onStateChange(), but who knows)
101+
-keepclassmembers class * {
102+
@android.arch.lifecycle.OnLifecycleEvent *;
103+
}
104+
105+
-keepclassmembers class * implements android.arch.lifecycle.LifecycleObserver {
106+
<init>(...);
107+
}
108+
109+
-keep class * implements android.arch.lifecycle.LifecycleObserver {
110+
<init>(...);
111+
}
112+
-keepclassmembers class android.arch.** { *; }
113+
-keep class android.arch.** { *; }
114+
-dontwarn android.arch.**

android-videostreamdecodingsample/app/src/main/AndroidManifest.xml

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
android:supportsRtl="true"
3535
android:theme="@style/AppTheme">
3636

37+
<uses-library android:name="org.apache.http.legacy" android:required="false" />
38+
3739
<meta-data
3840
android:name="com.dji.sdk.API_KEY"
3941
android:value="Please enter your App Key here."/>
@@ -57,4 +59,4 @@
5759
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity>
5860
</application>
5961

60-
</manifest>
62+
</manifest>

android-videostreamdecodingsample/app/src/main/java/com/dji/videostreamdecodingsample/ConnectionActivity.java

100644100755
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
import android.os.AsyncTask;
99
import android.os.Build;
1010
import android.os.Bundle;
11-
import android.support.annotation.NonNull;
12-
import android.support.annotation.Nullable;
13-
import android.support.v4.app.ActivityCompat;
14-
import android.support.v4.content.ContextCompat;
1511
import android.text.TextUtils;
1612
import android.util.Log;
1713
import android.view.View;
1814
import android.widget.Button;
1915
import android.widget.TextView;
2016
import android.widget.Toast;
2117

18+
import androidx.annotation.NonNull;
19+
import androidx.annotation.Nullable;
20+
import androidx.core.app.ActivityCompat;
21+
import androidx.core.content.ContextCompat;
22+
2223
import dji.sdk.sdkmanager.DJISDKInitEvent;
2324
import java.util.ArrayList;
2425
import java.util.List;
@@ -159,6 +160,11 @@ public void onConnectivityChange(boolean b) {
159160
public void onInitProcess(DJISDKInitEvent djisdkInitEvent, int i) {
160161
//notify the init progress
161162
}
163+
164+
@Override
165+
public void onDatabaseDownloadProgress(long l, long l1) {
166+
167+
}
162168
});
163169
}
164170
});

0 commit comments

Comments
 (0)