0

I found that run Task :app:collectNewuatReleaseDependencies FAILED

this task seem will get all dependencies from maven repository. Howevenr the Gradle show FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:collectNewuatReleaseDependencies'.

Could not resolve all artifacts for configuration ':app:newuatReleaseRuntimeClasspath'. Could not download push-ohos-5.2.0.305.har (com.huawei.hms:push-ohos:5.2.0.305) Could not get resource 'https://developer.huawei.com/repo/com/huawei/hms/push-ohos/5.2.0.305/push-ohos-5.2.0.305.har'. Could not GET 'https://developer.huawei.com/repo/com/huawei/hms/push-ohos/5.2.0.305/push-ohos-5.2.0.305.har'. Received status code 403 from server: Forbidden

Because the "har" file type is blocked by my company network.

Does any way to get dependencies from my local repository? or how can I ignore the task, which is "collect dependencies" when I build Release version?

I try to Mapping repository to my local folder

maven { url 'https://developer.huawei.com/repo/' }

to mavenLocal()

put "push-ohos-5.2.0.305.har" file into {MavenLocal}\com\huawei\hms\push-ohos\5.2.0.305\

But it still show > Could not get resource 'https://developer.huawei.com/repo/com/huawei/hms/push-ohos/5.2.0.305/push-ohos-5.2.0.305.har'.

MorEEE
  • 3
  • 1
  • 1. Place all of the dependency folder to maven local, not just the har file. 2. Place maven local before other repositories – Shlomi Katriel Jul 29 '23 at 17:51
  • 1
    You are right, I mapping all dependencies of HUAWEI to my local folder. It is build successfully. – MorEEE Jul 31 '23 at 09:34

1 Answers1

0

You can add your dependency inside "libs" folder in your project. This also true for aar, jar etc. dependencies. How to do that is for example here. Gradle should check all repositories for needed dependencies in repositories {} section. The first one listed will be used first. If there is problem you can exclude some dependency from that repository using "exclude" (see Gradle documentation)

Warlock
  • 2,481
  • 4
  • 31
  • 45
  • I will try it again, thanks for you reply. – MorEEE Jul 31 '23 at 07:58
  • I try to copy "har" file to libs folder and add dependency to my "build.gradle" file in app level. It's still get "har" file from the remote repository of HUAWEI. But I mapping all dependency to my local folder and place "mavenLocal()" before " maven { url 'https://developer.huawei.com/repo/' }". It's work fine, many thanks for your comment. – MorEEE Jul 31 '23 at 09:34
  • Glad to help. I'm not quite sure if you want to have "mavenLocal()" at all in your Gradle files. See linked article. If there are some problems with priority you can use maven { url=huaweiurl content { excludeModule("com.huawei.hms","push-ohos") } } which should exclude that "har" dependency. See Gradle documentation in the original response. https://medium.com/decisionbrain/when-to-not-use-mavenlocal-in-your-gradle-build-script-6da03902f9df – Warlock Jul 31 '23 at 20:22