0

I downloaded Telegram Source code from GitHub and Compile it. at first, it gave me some error about NDK_PROJECT_PATH = null and so as someone suggested i changed :

    sourceSets.main.jniLibs.srcDirs = ['./jni/']
    externalNativeBuild {        
    ndkBuild {
        path "jni/Android.mk"
       }
    }

to :

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

in gradle.
after run 2 .so file generated in libs\armeabi and libs\armeabi-v7a (both of them about 4kb) and i can get the LaunchActivity.java , but when i click on START MESSAGING the app crashes at ApplicationLoader.loadWallpaper(); (in LaunchActivity.java) which runs a runnable. i debbuged it until i reached to uncaughtException which was as following :
unsatisfiedlinkerror native method not found: org.telegram.messenger.Utilities.pinBitmap: (Landroid/graphics/Bitmap;)

after that i again compile native jni Manualy from command prompt (i mean going to nji parent folder and run ndk-build.cmd) . when compilation finished "obj" folder was created in nji parent folder and that 2 files generated again but with size of 14kb.
I replace them with old ones in the libs folder.

after Clean and Rerun, i still have same error (native method not found...).

can any body help me what's wrong with this NDK ?? any help would be appreciated.
Thanks, MA.

M.Armoun
  • 1,075
  • 3
  • 12
  • 38
  • Have you downloaded the NDK and pointed studio at it ? – Jon Goodwin Nov 08 '16 at 15:58
  • @Jon Goodwin ,of course , it's in C:\Users\Mohamad\AppData\Local\Android\sdk\ndk-bundle and I set it in Project structure – M.Armoun Nov 08 '16 at 16:12
  • 1
    Have you checked your `TARGET_PLATFORM`/`APP_PLATFORM`? It should match your minSdkVersion. Had a similar issue yesterday - this might help: http://stackoverflow.com/questions/40468805/unsatisfiedlinkerror-dlopen-failed-cannot-locate-symbol-aeabi-memcpy4-refe – vkislicins Nov 08 '16 at 17:15

1 Answers1

0

all the problem was because of the directory of my project. the directory contains space and it's not compatible with NDK. I moved the project to another directory and now it compiles.

M.Armoun
  • 1,075
  • 3
  • 12
  • 38