Android Question unable to compile DJI library example

Status
Not open for further replies.

freedom2000

Well-Known Member
Licensed User
Longtime User
Hi all,

I have got a DJI Spark, and of course I am trying to test the DJI library.
I have done most of the configuration stuff, created account, changed the package name, got the developper key...

But when trying to compile the example I have this error :

B4X:
B4A Version: 10.50
Parsing code.    (0.04s)
    Java Version: 8
Building folders structure.    (0.03s)
Running custom action.    (0.07s)
Compiling code.    (0.05s)
Compiling layouts code.    (0.00s)
Organizing libraries.    Error
Maven artifact not found: androidx.constraintlayout/constraintlayout

Of course I have tried to install it under the SDkManager (and it seems to be installed... but still failing to compile

constraint.jpg


I have searched on the forum and seen that some others got the same problem. But still stucked.
https://www.b4x.com/android/forum/t...und-when-compiling-djiexample.112200/#content

Any help would be highly apreciated !
Thanks
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Thanks @Erel for this help and sorry for my late reply...

I have checked android.jar. It points to this
paths.jpg


and deleted the lines with constraintlayout.
Then tried to reinstall them. But it definitively tries to download this (version 2.0.4 instead of 1.1.3)
And it gives the same error when compiling...

B4XSdk.jpg


I don't know where is my bug !
JP
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Thank you !

I have thus deleted the full android directory and recreated following the BA4 install guide.
I had also to add a few more components "services" and now I skip the errors

But here is a new one...
B4X:
B4A Version: 10.50
Parsing code.    (0.03s)
    Java Version: 8
Building folders structure.    (0.02s)
Running custom action.    (0.05s)
Compiling code.    (0.47s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Generating R file.    (0.00s)
Compiling generated Java code.    Error
Cannot find: C:\Program Files\Anywhere Software\Basic4android\libraries\dji-sdk-provided-4.14-trial1.jar

As suggested here, I did add these lines :
B4X:
#MultiDex: true
#AdditionalJar: dji-sdk-provided-4.14-trial1, ReferenceOnly

I have tried (randomly !) to change this line by (the name of the downloaded .aar file)
B4X:
#MultiDex: true
#AdditionalJar: dji-sdk-4.14-trial1.aar, ReferenceOnly

It seems to go a little further but not yet successfull
B4X:
B4A Version: 10.50
Parsing code.    (0.03s)
    Java Version: 8
Building folders structure.    (0.02s)
Running custom action.    (0.04s)
Compiling code.    (0.48s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.05s)
    (AndroidX SDK)
Generating R file.    (0.00s)
Compiling generated Java code.    Error
B4A line: 247
mission.Initialize(32.836084, 35.268652, 50, 300,
javac 1.8.0_51
src\fr\free\JulienGley\DjiSpark1\b4xmainpage.java:371: error: package dji.common.mission.hotpoint does not exist
_mission.Initialize(32.836084,35.268652,50,300,(float) (20),BA.getEnumFromString(dji.common.mission.hotpoint.HotpointHeading.class,"TOWARDS_HOT_POINT"));
                                                                                                            ^

Still need some help please !
Thanks
 
Upvote 0

freedom2000

Well-Known Member
Licensed User
Longtime User
Just to tell you that I successfully connected to my Spark drone
Spark <-> RC <-USB-> Android <-Wifi-> B4X IDE

The App launches fine and shows all sensors + camera (impressive !)
But the mission cannot start with the following error : Error uploading: The estimated time for the mission is too long

I did changed the lat lon in the main :
'change coordinates here and remove the ExitApplication
mission.Initialize(43.5167, 1.5, 50, 300, 20, "TOWARDS_HOT_POINT")

but still get the same error

However I am not sure that Spark is natively supporting WayPoints, they are hidden in DJI GO4 App
But with a patched version they appear and they do work very well (hidden feature to sell more expensive drones...).
I have to check if the waypoints are available in the API for Spark... Probably not seeing the DJI SDK doc...

Spark.jpg
 
Last edited:
Upvote 0
Status
Not open for further replies.
Top