Reputation: 31
I am trying to run the Mobile SDK tutorial and I think I did everything correctly as directed.
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.dji.importsdkdemo"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions{
doNotStrip "*/*/libdjivideo.so"
doNotStrip "*/*/libSDKRelativeJNI.so"
doNotStrip "*/*/libFlyForbid.so"
doNotStrip "*/*/libduml_vision_bokeh.so"
doNotStrip "*/*/libyuv2.so"
doNotStrip "*/*/libGroudStation.so"
doNotStrip "*/*/libFRCorkscrew.so"
doNotStrip "*/*/libUpgradeVerify.so"
doNotStrip "*/*/libFR.so"
doNotStrip "*/*/libDJIFlySafeCore.so"
doNotStrip "*/*/libdjifs_jni.so"
doNotStrip "*/*/libsfjni.so"
exclude 'META-INF/rxjava.properties'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation('com.dji:dji-sdk:4.11.1')
compileOnly('com.dji:dji-sdk-provided:4.11.1')
}
This is the manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dji.importsdkdemo">
<!-- Permissions and features -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature
android:name="android.hardware.usb.host"
android:required="false" />
<uses-feature
android:name="android.hardware.usb.accessory"
android:required="true" />
<!-- Permissions and features -->
<application
android:name=".MApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!-- DJI SDK -->
<uses-library android:name="com.android.future.usb.accessory" />
<meta-data
android:name="com.dji.sdk.API_KEY"
android:value="my app key" />
<activity
android:name="dji.sdk.sdkmanager.DJIAoaControllerActivity"
android:theme="@android:style/Theme.Translucent" >
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>
<service android:name="dji.sdk.sdkmanager.DJIGlobalService" >
</service>
<!-- DJI SDK -->
<activity android:name=".MainActivity"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
My errors:
error: cannot find symbol class BaseProduct
error: cannot find symbol class Handler
error: cannot find symbol class List
error: cannot find symbol class AtomicBoolean
error: cannot find symbol class NonNull
error: cannot find symbol class NonNull
error: cannot find symbol class ArrayList
error: cannot find symbol class AtomicBoolean
error: package Build does not exist
error: package Build does not exist
error: cannot find symbol class Handler
error: cannot find symbol variable Looper
error: cannot find symbol variable ContextCompat
error: cannot find symbol variable PackageManager
error: package Build does not exist
error: package Build does not exist
error: cannot find symbol variable ActivityCompat
error: cannot find symbol variable PackageManager
error: package DJISDKManager does not exist
error: cannot find symbol variable DJISDKManager
error: cannot find symbol variable AsyncTask
error: cannot find symbol class Intent
error: cannot find symbol class Intent
error: cannot find symbol class Handler
error: cannot find symbol class Handler
error: cannot find symbol variable Looper
error: cannot find symbol variable Toast
error: cannot find symbol variable Toast
Sync project with grade files is running. If i try to make the project i get a lot of errors and the build failed. The java compiler cannot find many symbol classes or the package build doesn't exist and so on. Have i done something wrong or do i have to add or change something on my own? I am still a beginner and have been trying to solve the problem for days.
Maybe someone can help me here.
Best regards
Upvotes: 1
Views: 344
Reputation: 1767
I noticed that you appear to be missing the SDK key. This is required in order to grant you access to use the SDK. Without it any SDK calls will fail.
You need to log into your DJI developer account and create a key.
<meta-data
android:name="com.dji.sdk.API_KEY"
android:value="my app key" />
Upvotes: 1