0

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

oded bartov
  • 391
  • 1
  • 2
  • 9

1 Answers1

1

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!

Ivan Garza
  • 553
  • 2
  • 14
  • Did you menr app.Gradle? I don't find any Gradle.Build. I tried it but then i get this new erorr: FAILURE: Build failed with an exception. * What went wrong: Task 'assembleDebug' not found in root project 'tripper'. * Try: Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 4s Command gradlew.bat failed with exit code 1 And why do i even have to do this? I removed the NPM – oded bartov Dec 06 '21 at 19:13
  • Ah, I see (both comments). Well, I would recommend you simply move away from this library, as Android has at least two different ways of finding the information you're looking for. I'll update my answer to showcase a couple. – Ivan Garza Dec 06 '21 at 19:16
  • I don't get it, What do you mean by "move away from this library"? How do i do that? I already uninstalled it a long time ago – oded bartov Dec 06 '21 at 19:22
  • I updated my answer above. But generally, I mean you may consider getting what you want in a different way. – Ivan Garza Dec 06 '21 at 19:23
  • I don't want to get the keyboard's height anymore, I just want to build my project successfully! – oded bartov Dec 06 '21 at 19:24
  • Ah! My bad, I misunderstood this a little bit. In that case, it seems that you may have a POM file that needs to be deleted. POM files roughly try to find certain dependencies for projects, so having one that is not being used wouldn't be idea. Have you looked for a file in your project called `keyboardheightprovider-0.0.9.pom`? – Ivan Garza Dec 06 '21 at 19:27
  • I can't find any POM file in my project – oded bartov Dec 06 '21 at 19:29
  • Debuggin Gradle is a pain in the ass.. Have you tried running the Gradle build command with `--stacktrace` or `--debug` flags? Send me the results through chat, I could take a look for ya. – Ivan Garza Dec 06 '21 at 19:40
  • 1
    Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/239893/discussion-between-oded-bartov-and-ivan-garza). – oded bartov Dec 06 '21 at 19:41