Telegram source code on android source code gives ‘java.lang.UnsatisfiedLinkError:’

Issue

When I run the Latest telegram source in mac in android studio, I get this error –

java.lang.UnsatisfiedLinkError: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
            at org.telegram.tgnet.ConnectionsManager.native_setJava(Native Method)
            at org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:266)

I applied the solution given here – Android Telegram App –> java.lang.UnsatisfiedLinkError: No implementation found for void but got no success.

I even have the latest NDK downloaded and installed on my mac. What might be the problem here ?

build.gradle (Module: TMessagesProj)

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
    jcenter()
}

task nativeLibsToJar(
    type: Zip,
    description: 'create a jar archive of the native libs') {
    destinationDir file("$buildDir/native-libs")
    baseName 'native-libs'
    extension 'jar'
    from fileTree(dir: 'libs', include: '**/*.so')
    into 'lib/'
}

tasks.withType(JavaCompile) {
    options.encoding  "UTF-8"
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn(nativeLibsToJar)
}

dependencies {
    compile 'com.android.support:support-v4:23.1.+'
    compile 'com.googlecode.mp4parser:isoparser:1.0.+'
    compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    useLibrary 'org.apache.http.legacy'
    defaultConfig.applicationId  "org.telegram.messenger"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    signingConfigs {
        debug {
            storeFile file("config/debug.keystore")
        }

        release {
            storeFile file("config/release.keystore")
            storePassword "none"
            keyAlias "RELEASE_KEY_ALIAS"
            keyPassword "RELEASE_KEY_PASSWORD"
        }
    }

    buildTypes {
        debug {
            debuggable true
            jniDebuggable true
            signingConfig signingConfigs.debug
        }
        release {
            debuggable false
            jniDebuggable false
            signingConfig signingConfigs.debug
        }
        foss {
            debuggable false
            jniDebuggable false
            signingConfig signingConfigs.release
        }
    }



    sourceSets.debug {
        manifest.srcFile 'config/debug/AndroidManifest.xml'
    }

    sourceSets.release {
        manifest.srcFile 'config/release/AndroidManifest.xml'
    }

    sourceSets.foss {
        manifest.srcFile 'config/foss/AndroidManifest.xml'
    }

    defaultConfig {

        minSdkVersion 10
        targetSdkVersion 23
        versionCode 719
        versionName "3.4.2"

    }
}

Solution

I also faced this error while I was trying to open the project in Intellij idea,later I Installed the latest version of Android studio and I Upgraded the Gradel and also the required repositories in sdk manager, after that all the errors has gone-but remember that ,don’t try to do anything while it’s indexing.

Answered By – Arya Aghaei

Leave a Comment