Need help building the Mobile SDK 4.16.2 Sample App in Android Studio

Completed

Comments

5 comments

  • DJI Developer Support
    You can go to the settings of Android Studio and check if API 31 is added in the SDK Manager. If it is not added, you may need to add it.
    0
    Comment actions Permalink
  • yating.liao

    0
    Comment actions Permalink
  • Mike Kang

    Hi Yating,

    Unfortunately your suggestion did not work, but the good news is that I found the solution.

    There were two problems. 

    The first problem is that the Gradle build scripts call dx.bat and use dx.jar library, but in the new build tools these files are renamed to d8.bat, and d8.jar. I have found those files and renamed them to dx.bat and dx.jar. 
    The above solution was suggested by this link: https://stackoverflow.com/questions/68387270/android-studio-error-installed-build-tools-revision-31

    The second problem is with sun libraries. This requires changes to the gradle_properties file to make three packages visible to the build scripts:

    org.gradle.jvmargs=-Xmx1920M \
    --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
    --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
    --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

    The above solution is suggested by this link: https://stackoverflow.com/questions/71257962/how-can-i-fix-this-error-with-butterknife-in-android-studio

    I suspect this would a common problem to many programmers who would like to try DJI SDK.
    It would be helpful for you to modify these files in the SDK so these problems would not appear by default. 

    Thanks,
    Michael

    2
    Comment actions Permalink
  • DJI Developer Support
    Thank you very much for your response and willingness to provide us with your solution. We will try to optimize it or compile a list of common issues. Thank you again for your response.
    0
    Comment actions Permalink
  • Mike Kang

    Thanks very much!

    0
    Comment actions Permalink

Please sign in to leave a comment.