I am an Android NDK developer, and a newbie to macOS, I was used the Android Studio on Ubuntu before, and it works well.Now I use macOS, I find when I try to open the c or cpp files which defines the JNI method, my Android Studio will stuck, I have to wait for at least 5 minutes, you know, this project is big, but it won't take much time when I use Ubuntu.Even if it was opened successfully, when I keep it opened, Android Studio become very hard to use, sometimes I even can't type!Sometimes when I open that file, Android studio just doesn't response and I have to force quit it.
Anyway, I think my problem is something to do with the c/cpp file support of Android studio, Can someone have experience in this field help me? Thanks very much!
I wonder if it is something to do with the declaratin of JNI method, my colleague write it, uses macro:
#define JNI_METHOD(return_type, method_name)
JNIEXPORT return_type JNICALL
Java_com_example_sometype_ClassName_##method_name
// and use it like this way
JNI_METHOD(jlong, nativeMethod)(
JNIEnv *env, jobject instance) {
// ...
}
Android Studio 2.2.2 Build #AI-145.3360264, built on October 18, 2016 JRE: 1.8.0_112-release-b05 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
mac OS Sierra Version 10.12
I use Android.mk to build my project, and I add it in build.gradle :
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
Edit 2016-10-27 :
I found something:
I have a large header file which has 53025 lines. When Android Studio open any file included this header file, it will stuck. I think it is reason but I still don't know how to solve this problem.
I will answer my question myself.
This is the truth
I found something:
I have a large header file which has 53025 lines. When Android Studio open any file included this header file, it will stuck. I think it is reason but I still don't know how to solve this problem.
This header file is the root cause and I create a source file to save this data, declare the variables in the header file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With