Open he1ex-tG opened 2 years ago
This library wasn't built for Android
You've to adapt, I guess.
This library wasn't built for Android
It looks like you are right. I tried to run the same code in Kontlin console application (win10) and it works good. I write Kotlin Andriod project and want to get notifications by Telegram. What options I have? Build http requiests?
I think you should fork and use a library (Like: okhttp, retrofit) that specializes in HTTP request (and etc). And use that specialized library, adapt and replace the current one that doesn't exist on Android but that exists on Desktop. Got it?
I always recommend doing it in an adapted way, but if you want something more agile: https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.3.4
That should works, add that on your project's build.gradle. (Not sure if that library is the correct one)
I always recommend doing it in an adapted way, but if you want something more agile: https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.3.4
That should works, add that on your project's build.gradle. (Not sure if that library is the correct one)
implementation ("org.apache.httpcomponents:httpclient:4.3.6") implementation ("org.telegram:telegrambots:5.5.0") { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } Here I downgrade the module whit early version -> I am getting error message: Cannot resolve symbol 'NoopHostnameVerifier'. It's true. Metod NoopHostnameVerifier is used in bot code but httpclient version 4.3.6 did not have this.
I think you should fork and use a library (Like: okhttp, retrofit) that specializes in HTTP request (and etc). And use that specialized library, adapt and replace the current one that doesn't exist on Android but that exists on Desktop. Got it?
Yes, I got. But it too hard to my purposes )) I started using okhttp and already got positive results.
Thank you, bro!
I always recommend doing it in an adapted way, but if you want something more agile: https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.3.4 That should works, add that on your project's build.gradle. (Not sure if that library is the correct one)
implementation ("org.apache.httpcomponents:httpclient:4.3.6") implementation ("org.telegram:telegrambots:5.5.0") { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } Here I downgrade the module whit early version -> I am getting error message: Cannot resolve symbol 'NoopHostnameVerifier'. It's true. Metod NoopHostnameVerifier is used in bot code but httpclient version 4.3.6 did not have this.
Try with:
implementation ("org.apache.httpcomponents:httpclient:4.5.13") implementation ("org.apache.httpcomponents:httpmime:4.5.13")
I always recommend doing it in an adapted way, but if you want something more agile: https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.3.4 That should works, add that on your project's build.gradle. (Not sure if that library is the correct one)
implementation ("org.apache.httpcomponents:httpclient:4.3.6") implementation ("org.telegram:telegrambots:5.5.0") { exclude group: 'org.apache.httpcomponents', module: 'httpclient' } Here I downgrade the module whit early version -> I am getting error message: Cannot resolve symbol 'NoopHostnameVerifier'. It's true. Metod NoopHostnameVerifier is used in bot code but httpclient version 4.3.6 did not have this.
Try with:
implementation ("org.apache.httpcomponents:httpclient:4.5.13") implementation ("org.apache.httpcomponents:httpmime:4.5.13")
No effect. I got the same error.
Although not officially supported, the library may work now properly on Android
Hi @rubenlagus, I'm trying to use the library on Android and I've seen all the messages here but no luck to make it work. I have the same problem of this issue..
I've just read your message "Although not officially supported, the library may work now properly on Android" how?
I am using Android Studio 4.1.3, and I am writing project in Kotlin according to this instruction https://github.com/rubenlagus/TelegramBots/wiki/Getting-Started
But I get the runtime error: java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes4.dex)
How can I resolve this issue?