Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample code doesn't compile #401

Closed
b-caveiro opened this issue Aug 19, 2024 · 13 comments
Closed

Sample code doesn't compile #401

b-caveiro opened this issue Aug 19, 2024 · 13 comments

Comments

@b-caveiro
Copy link

Hello DJI team,

I am starting with the DJI Mobile SDK development and having issues with the dependencies while compiling the code. Some instructions seem to be outdated (different versions of Android Studio mentioned in Run Sample Code and Empty Project Import MSDK). I've also tried to compile with almost all tags between V5.8.0 - V5.10.0 and all of them had the same issue

Here's my setup (./gradlew --version):

Android Studio Giraffe | 2022.3.1 Patch 4
Gradle 7.6.2
Kotlin:       1.7.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.24 (Ubuntu 11.0.24+8-post-Ubuntu-1ubuntu322.04)
OS:           Linux 6.2.0-39-generic amd64

The main dependency error during the compilation looks like this:

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':sample:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
   > Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
     Searched in the following locations:
       - https://repo1.maven.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://jcenter.bintray.com/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://dl.bintray.com/kotlin/kotlin-eap/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - https://jitpack.io/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
       - file:/home/bruno/Git/Mobile-SDK-Android-V5/SampleCode-V5/android-sdk-v5-as/libs/mapbox-android-accounts-0.7.0.jar
       - file:/home/bruno/Git/Mobile-SDK-Android-V5/SampleCode-V5/android-sdk-v5-as/libs/mapbox-android-accounts.jar
     Required by:
         project :sample > project :uxsdk > org.maplibre.gl:android-sdk:9.4.2

Full output of the build with errors: compilation_output_error.txt

I've registered accounts to create tokens and put them inside gradle.properties file:

Thank you in advance for your help!

@dzx815
Copy link

dzx815 commented Aug 20, 2024

image

我这边都注册不上。

@dji-dev
Copy link
Contributor

dji-dev commented Aug 20, 2024

Agent comment from yating.liao in Zendesk ticket #115030:

The error you are encountering appears to be related to the network you are using. It indicates that the library mapbox-android-accounts cannot be found in the repository set in your configuration file. Have you checked if your network is functioning properly? For instance, have you configured a network proxy or something similar?

°°°

@dzx815
Copy link

dzx815 commented Aug 20, 2024

我5.4版本是开源正常运行的,5.10版本跟这个人的问题是一模一样。
同一台电脑,不管用不用代理都是一样的。

@sensoarltd
Copy link

Same error for me

Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 22.0.2 (Eclipse Adoptium 22.0.2+9)
OS: Mac OS X 14.4 aarch64

@b-caveiro
Copy link
Author

b-caveiro commented Aug 20, 2024

Hello, @dji-dev

It doesn't seem to me that proxy or network is the issue and here are my arguments:

  • I've never set up proxy - it's disabled in linux settings and echo "$http_proxy" or echo "$https_proxy" don't give any output.
  • The Android Studio is downloading many packages successfully when I change the gradle version or/and tags. You can see the example output below or in this idea_debug.log file.
    image
  • I tried to compile in different locations under different WIFI networks, including my direct mobile internet.
  • I am normally invalidating all the cache before I try to recompile with different settings/tags.
  • I don't use VPN.

I am also able to find some mapbox package related files on my computer, here's the output of the sudo find / -name "*mapbox*" command - find_mapbox.log.

@dzx815 Thank you for the tip. I tried to compile tag v5.4.0. although I was able to get further in the compilation process (after I changed the gradle to 7.6.2, by default it was set to 6.1 and it didn't work). I am still encountering the same issue, but later into build. Here is the log - build_v5-4-0_tag.log.
@dzx815 can you please tell me what framework settings are you using ./gradlew --version?

P.S. sorry I've closed the issue by mistake

@b-caveiro b-caveiro reopened this Aug 20, 2024
@dzx815
Copy link

dzx815 commented Aug 21, 2024

Android Studio Giraffe | 2022.3.1 Patch 4
distributionUrl=https://services.gradle.org/distributions/gradle-7.2-bin.zip

KOTLIN_VERSION = 1.6.10

dependencies {
    classpath 'com.android.tools.build:gradle:4.2.2'
    classpath 'com.github.kezong:fat-aar:1.3.6'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
    classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.1.1'
    classpath "org.jacoco:org.jacoco.core:0.8.7"
}

@dzx815
Copy link

dzx815 commented Aug 21, 2024

我把V5.10.0的配置,除了KOTLIN_VERSION = 1.7.21,其他的都按前面V5.4的配置,也编译成功了。
image

@dji-lyt
Copy link

dji-lyt commented Aug 21, 2024

@b-caveiro You can to try configuring the Gradle version to 7.x, for example, using Gradle version 7.6.2 or 7.3.3, and AGP version 7.4.2 or 7.0.3.

@hiropeng
Copy link

I got same error, and I solved it with adding three line in allprojects block

        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://repo.huaweicloud.com/repository/maven' }

@b-caveiro
Copy link
Author

b-caveiro commented Aug 21, 2024

@hiropeng thank you for your suggestion. Unfortunetely, doesn't seem to work for me. Tried to compile it for 5.8.0 and 5.8.10 and got the same error.

diff --git a/SampleCode-V5/android-sdk-v5-as/build.gradle b/SampleCode-V5/android-sdk-v5-as/build.gradle
index be0dd212..8875208e 100644
--- a/SampleCode-V5/android-sdk-v5-as/build.gradle
+++ b/SampleCode-V5/android-sdk-v5-as/build.gradle
@@ -9,6 +9,9 @@ buildscript {
         maven { url 'https://maven.fabric.io/public' }
         maven { url 'https://plugins.gradle.org/m2/' }
         maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
+        maven { url 'https://maven.aliyun.com/repository/public' }
+        maven { url 'https://maven.aliyun.com/repository/google' }
+        maven { url 'https://repo.huaweicloud.com/repository/maven' }

Could you please share other settings of your project? Which version are you compiling and which gradle/kotlin/AGP are you using?

@hiropeng
Copy link

you added in buildscript block? I added it in allprojects block
スクリーンショット 2024-08-21 23 23 08

@b-caveiro
Copy link
Author

b-caveiro commented Aug 21, 2024

@hiropeng Thank you, it worked! 🎉

For people who will encounter this problem, here are my settings and git diff for v5.10.0:

------------------------------------------------------------
Gradle 7.6.2
------------------------------------------------------------

Build time:   2023-06-30 15:42:51 UTC
Revision:     dab132169006b16e7ada4ab2456e0c9d6415b52a

Kotlin:       1.7.10
Groovy:       3.0.13
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.24 (Ubuntu 11.0.24+8-post-Ubuntu-1ubuntu322.04)
OS:           Linux 6.2.0-39-generic amd64

diff --git a/SampleCode-V5/android-sdk-v5-as/build.gradle b/SampleCode-V5/android-sdk-v5-as/build.gradle
index be0dd212..8334c3d6 100644
--- a/SampleCode-V5/android-sdk-v5-as/build.gradle
+++ b/SampleCode-V5/android-sdk-v5-as/build.gradle
@@ -35,5 +35,8 @@ allprojects {
                 dirs new File(rootProject.projectDir.getAbsolutePath() + '/libs')
             }
         }
+        maven { url 'https://maven.aliyun.com/repository/public' }
+        maven { url 'https://maven.aliyun.com/repository/google' }
+        maven { url 'https://repo.huaweicloud.com/repository/maven' }
     }
 }

@eMPee584
Copy link

eMPee584 commented Sep 3, 2024

        maven { url 'https://maven.aliyun.com/repository/public' }
        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://repo.huaweicloud.com/repository/maven' }

@hiropeng and how did you choose these URLs? is there a place to check for availability of outdated java libs 😁 like f.e. pkgs.org for linux packages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants