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

Error when trying to generate APK with the lib: Could not resolve all artifacts for configuration ':react-native-blob-courier:debugUnitTestRuntimeClasspath'. #186

Closed
limaCoder opened this issue Jan 14, 2022 · 14 comments · Fixed by #188
Assignees
Labels
Android bug Something isn't working investigate
Milestone

Comments

@limaCoder
Copy link

Description
I developed an APP using the library without any problems, but when I tried to generate an APK occurs this error on the terminal and I haven't found any solutions on the web or here...

Steps to reproduce the behavior:

  1. Go to projectName/android
  2. type the command 'gradlew assembleRelease'
  3. See the error

Screenshots
imagem_2022-01-14_101712

@edeckers
Copy link
Owner

edeckers commented Jan 14, 2022

Hi @limaCoder, thank you for reaching out and for your detailed bug description!

I'll have to investigate the exact reason for this exception, but you should be able to fix it by adding android.jetifier.blacklist=bcprov-jdk15on to the gradle.properties of your app, like so:
https://github.com/edeckers/react-native-blob-courier/blame/711cc1a5d1550a1161f6a0ed970580c5a6748a4b/example/android/gradle.properties#L22

Let me know if it works for you!

Once I find time for further investigation I'll post my findings here.

@limaCoder
Copy link
Author

Hi @edeckers! So, at first, I received this warning indicating that android.jetifier.blacklist=bcprov-jdk15on is deprecated and also have usages of jcenter().

print-error2

After that, the build failed with an exception below... that line of code didn't resolve the problem :(

print-error3

@edeckers
Copy link
Owner

edeckers commented Jan 14, 2022

That's annoying :(

There's hope though, because gradlew assembleRelease does work on the example app included in this repository. So something in its config overcomes this problem. I'm thinking it might be this:

Can you add / modify these lines in your android/app/build.gradle file in the android block - see the line I linked above for context:

lintOptions {
  abortOnError false
  checkReleaseBuilds false
}

@ebrahimhassan121
Copy link

you can try this solution https://stackoverflow.com/a/70689804/10811237

@limaCoder
Copy link
Author

@edeckers I added these lines and it stopped giving errors in the build! But it's not recommended to set the value of 'abortOnError' to 'false', which can be a problem with the app in production because it's important to know if the app contains errors...

I really enjoyed the lib, managed to be the only one that served me well to make downloads in a simple way! I want to continue to use it, so could you try to fix this bug and notify me as soon as possible?

@edeckers
Copy link
Owner

edeckers commented Jan 14, 2022

Happy it helped you @limaCoder and thanks for chiming in @ebrahimhassan121! I'll look into this issue as soon as possible and fix it an appropriate manner.

Expectation management: I think I will get to it in the upcoming two weeks, but I can't promise. I'll keep you posted through this thread.

@edeckers
Copy link
Owner

For posterity, because it was mentioned in this thread several times:
While every library should move away from jcenter because it's deprecated, nothing will break if they won't as "JFrog has decided to keep JCenter as a read-only repository indefinitely".

I've created an issue to replace it in the near future!

@edeckers edeckers added the bug Something isn't working label Jan 14, 2022
@limaCoder
Copy link
Author

Thanks, @edeckers, I appreciate it a lot! I'll be waiting for the fix :)

@edeckers
Copy link
Owner

Fixed the issue by bumping a few dependencies: I'll try to release it this weekend!

@edeckers
Copy link
Owner

For future reference: #187 (comment)

Hi @edeckers! I updated the package version to the latest published (3.0.4), and it's still getting the same error related here, on the build time :(

What version of RN are you using? I've compiled the example app included in this repository on both 0.62.2 and 0.66.1 after the changes I made in #188, which worked fine for me even after I changed abortOnError to true.

Are you running into the bcprov-jdk15on error of your opening post? Or into the the TargetInvocationException?

@limaCoder
Copy link
Author

I am using 0.65.1 version of RN! I removed the android.jetifier.blacklist=bcprov-jdk15on code line, the error I'm getting it's this, the same as the first print:

print-error4

@edeckers
Copy link
Owner

edeckers commented Jan 17, 2022

Hmm, I think you might be using an older version of android-gradle-plugin: it should be 7.0.+ if you're using Jetifier. This will in turn require you to upgrade gradlew to ^7.0.2.

Can you try if these changes work for you? If they do I'll make sure to add them to the README.md.

Relevant lines in the Example app:

  1. AGP -> 7.0.+
  2. Gradlew -> 7.0.2

@limaCoder
Copy link
Author

@edeckers it worked!!! I changed the relevant lines that you have mentioned in the example app and the error had stopped! Thanks a lot, @edeckers , I'm happy now! Include in README.md the version of android-gradle-plugin it should be 7.0.+ will help other people too :)

@edeckers
Copy link
Owner

Awesome @limaCoder! I'll make sure to add it, thank you for reporting back and enjoy your working app :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android bug Something isn't working investigate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants