oded bartov
oded bartov

Reputation: 431

Why does this old dependency crashes my gradle?

A long time ago i installed a package which gives me the height of the keyboard on an android device. Eventually the package didn't served well my purpose so i uninstalled it. A few days ago i tried to build my app but i got the following error:

Build file 'C:\Users\odedo\Documents\GitHub\tripper\app\platforms\android\app\build.gradle' line: 598
A problem occurred configuring project ':app'.
Could not GET 'https://dl.bintray.com/crysis21/Android/com/hold1/keyboardheightprovider/0.0.9/keyboardheightprovider-0.0.9.pom'. Received status code 403 from server: Forbidden

Command gradlew.bat failed with exit code 1

Apparently the package is no longer available and i should add this dependency to my code:

implementation 'ro.holdone:keyboardHeightProvider:1.0.3'

My questions are:

  1. Where should i add this line??? I couldn't find any clear unstructions of this simple action...
  2. Why do i still get this error? I removed this package a long time ago! I cleaned my platforms and i can't find any trace for it in my project. How to i get rid of it?

Here is the NPM: https://github.com/Crysis21/KeyboardHeightProvider And here is the same question asked here on Stack overflow which didn't helped at all: implementation 'com.hold1:keyboardheightprovider:0.0.9'

I am desperate for a solution... Please help

Upvotes: 0

Views: 201

Answers (1)

Iván Garza Bermea
Iván Garza Bermea

Reputation: 742

I left a question for you as a comment above for clarifications, but generally dependencies are added to the build.gradle files; either at the project- or app-level.

I would assume you need to add this dependency at the application-level Gradle file, as it is more usual, so look for the dependencies portion of the build.gradle file (usually at the bottom) and add it as such:

android {
   ...
}
dependencies {
   ...
   implementation 'ro.holdone:keyboardHeightProvider:1.0.3'
}

UPDATE: As an alternative, I would recommend you simply move away from 3rd-party libraries that help you do or find things that Android already provides. There's two main ways I can think you can do this:

  1. You can implement a GlobalLayoutListener to figure out the total size of the application's layout, and from there deduce the total size that the soft-keyboard is occupying. This answer from a different question sort of explains this process.

  2. The second way you can find out the size of your keyboard is mentioned in the link you shared above, and is by leveraging Android's WindowInsets APIs from androidx to get exact measurements you're looking for. I believe this solution may only be available for higher Android version, so choose your weapons wisely!

Upvotes: 1

Related Questions