td icon indicating copy to clipboard operation
td copied to clipboard

How to use tdlib in android studio (java)

Open cheaterNo1 opened this issue 3 years ago • 4 comments

Unlike all the other libs, tdlib is quite difficult to install. What I did:

  • Install CMake.
  • Download tdlib.zip from https://core.telegram.org/tdlib/tdlib.zip.
  • Unzip tdlib.zip:
    • Create jniLibs folder in myProject src/main/ and copy 4 folders from libtd/src/main/libs/ to jniLibs
    • Copy the corresponding Java classes to myProject src/main/java/

p1

And when I try to run NativeClient, it show:

p2

What should I do for now?

cheaterNo1 avatar Mar 26 '22 02:03 cheaterNo1

Have you added

android {
    sourceSets {
        main {
            jniLibs.srcDirs = ['src/main/jniLibs']
        }
    }
}

to your build.gradle?

levlam avatar Apr 06 '22 13:04 levlam

p1

Nothing changes !

cheaterNo1 avatar Apr 09 '22 02:04 cheaterNo1

This should be enough to find libtdjni.so in subdirectories of jniLibs.

You may also need jni.srcDirs = [], but only to prevent attempts to build native libraries:

    sourceSets.main {
        jniLibs.srcDir 'src/main/jniLibs'
        jni.srcDirs = [] //disable automatic ndk-build call
    }

levlam avatar Apr 09 '22 22:04 levlam

p1

cheaterNo1 avatar Apr 16 '22 01:04 cheaterNo1

Unlike all the other libs, tdlib is quite difficult to install. What I did:

  • Install CMake.

  • Download tdlib.zip from https://core.telegram.org/tdlib/tdlib.zip.

  • Unzip tdlib.zip:

    • Create jniLibs folder in myProject src/main/ and copy 4 folders from libtd/src/main/libs/ to jniLibs
    • Copy the corresponding Java classes to myProject src/main/java/

p1

And when I try to run NativeClient, it show:

p2

What should I do for now?

did you solved ?

vniiphone avatar Jun 06 '23 10:06 vniiphone