Android Telegram App --> java.lang.UnsatisfiedLinkError: No implementation found for void

后端 未结 5 1722
挽巷
挽巷 2020-11-27 05:18

Unfortunally a similar question was removed at Stackoverflow some weeks ago, I must make a new question.

Im trying to build an own Telegram app for android via sourc

相关标签:
5条回答
  • 2020-11-27 05:45

    So, to solve your issue, you can remove your 64-bit libs from your build, or set abiFilters to package only 32-bit architectures:

    android {
    ....
    defaultConfig {
        ....
        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
        }
    }
    

    }

    add android.useDeprecatedNdk=true to a file named gradle.properties at the root of your project

    0 讨论(0)
  • 2020-11-27 05:47

    I had a similar error message. The solution for me was to deinstall the app from the simulator, clean the project (including all libraries) and do a rebuild. Now the app starts fine.

    0 讨论(0)
  • 2020-11-27 05:48

    The main problem is that you're running the project without generating the native library from the C/C++ codes. Because of that project based on Telegram, which you point it out with the link, has the file Android.mk on the jni directory , you have to compile the code manually. I fixed that exception following these steps:

    • Check that build.gradle contains:

    source version 3.13.1 and newer:

    sourceSets.main.jniLibs.srcDirs = ['./jni/']
    

    source version lower than 3.13.1:

        sourceSets.main {
           jniLibs.srcDirs = 'libs'
           jni.srcDirs = [] //disable automatic ndk-build call
        }
    
    • Download the NDK

    Proceed according to your operating system.

    Linux / Mac

    $ cd <path-to-Telegram>/TMessagesProj
    $ <path-to-ndk>/ndk-build
    

    Windows

    • Download Cygwin
    • Add on .bashrc file, which is placed on Cygwin root directory (use some utility to find that file). In my case, the file was placed in C:\cygwin64\home\myuser.

      export ndkbuild=/cygdrive/partition_name/your_ndk_directory/ndk-build.cmd
      
    • Open the Cygwin terminal and move yourself towards the jni directory of the project:

      cd /cygdrive/your_partition_name/project_jni_directory_path
      
    • Write $ndkbuild and wait the compiler finishes its task. If this process is right, two directories will show up, obj and libs. Check that libs directory contains some library with .so extension. Finally, run the project.

    0 讨论(0)
  • 2020-11-27 06:02

    As Jesús Castro mentioned, you have to compile native codes to libraries with .so suffix that android can use them for running app.

    But why this is happened newly? Because in the last commit of DrKLO's Telegram repository they have removed the prebuilt libraries according to commit message in git:

    Removing prebuilt libraries. The source code for all libraries is (and always was) available here: https://github.com/DrKLO/Telegram/tree/master/TMessagesProj/jni

    You can find the commit here.

    0 讨论(0)
  • 2020-11-27 06:12

    @Rajsundar . If adding the line :

    export ndkbuild=/cygdrive/c/android-ndk-r10e/ndk-build.cmd
    

    is not working. After doing everything else you can simply run the command directly from the jni directory.

    /cygdrive/c/android-ndk-r10e/ndk-build.cmd
    
    0 讨论(0)
提交回复
热议问题