Need help building the Mobile SDK 4.16.2 Sample App in Android Studio
CompletedI tried to build the Mobile SDK 4.16.2 Sample App downloaded from github: https://github.com/dji-sdk/Mobile-SDK-Android.
I am getting build errors. Tried different versions of Android Studio. The errors are different but similar.
The last version of Android Studio I tried was Chipmunk 2021.2.1 Patch 2. Some of the errors are:
The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not create task ':app:minifyDebugWithR8'.
Cannot query the value of this provider because it has no value available.
Failed to notify build listener.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not create task ':app:minifyDebugWithR8'.
Cannot query the value of this provider because it has no value available.
> Failed to stop service 'com.android.build.gradle.internal.errors.SyncIssueReporterImpl$GlobalSyncIssueService_0cfceb5f-1dbe-4388-9aae-6b5976030bc4'.
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
..........
Can anyone provides some hint as which version of the Android Studio to use and how to resolve these errors?
Thanks very much!
Mike
-
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-31The 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-UNNAMEDThe 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
Please sign in to leave a comment.
Comments
5 comments