Saturday, February 8, 2014

SO how to reference a third-party file


            
You God,
I already have a project in 3 SO files, these three documents are SO C language and then write their own generation. Of course, success. Nothing to say.
The problem is, I now want to refer BAIDU of locSDK3.SO, which is GPRS. How do I add it? I direct locSDK3.SO into armeabi folder will be deleted. How do I deal with, must be done in your own oh.

My approach is as follows:
Step 1: Generate the JNI folder under a new directory prebuilt, and then generate a android.mk inside, the locSDK3.SO COPY into prebuilt this android.mk follows:.
LOCAL_PATH: = $ (call my-dir)

include $ (CLEAR_VARS)

LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = liblocSDK3.so
include $ (PREBUILT_SHARED_LIBRARY)


Step 2: Add
behind android.mk file in the directory jniinclude $ (CLEAR_VARS)

LOCAL_SHARED_LIBRARIES: = prebuilt/locSDK3
include $ (LOCAL_PATH) / prebuilt / Android.mk


At this point in the libs directory will generate a new liblocSDK3.so file, only 5K. The system will be prompted to install this file.
Install: liblocSDK3.so => ​​libs/armeabi/liblocSDK3.so
I think this is a problem. Because I see liblocSDK3.so armeabi directory only 5K. The real liblocSDK3.so have 40K

Reply:
I was directly into armeabi folder, and did not come across the situation has been deleted. . .
Reply:
Oh, the answer is very near from the landlord, you prebuilt is right, but the whole process is a bit messy, this project just to have a Android.mk on the line: under the Android.mk prebuilt deleted, because the file is not necessary, Then create an under jni Android.mk (general engineering are like this, the next one jni Android.mk), and then add your code to the beginning of the prebuilt mk files, but for a change directory: LOCAL_SRC_FILES: = prebuilt / liblocSDK3.so, then change one on the list:
LOCAL_SHARED_LIBRARIES: = prebuilt/locSDK3 to
LOCAL_SHARED_LIBRARIES: = locSDK3
This time you compile, will pass, and I was done
actual projectDo you think the file smaller I do not know why, because I have never encountered such a situation, but I suggest you try to press my method, if it is smaller, there is a problem
Reply:
LocSDK3.SO copy directly into the line, android.mk being without any modification, because. Mk is used at compile time, the equivalent of an index, which is used to specify compile c file, and then generate so files, and since是. so, the documentation has been compiled, and do not need to re-compile, as to why will be smaller, because. mk file specifies compile a locSDK3.SO, it will delete the existing namesake so compile-time, re-compiled, and may not have any corresponding jni c file or you did not specify which files to compile, so the file so almost no actual data
Reply:
Baidu locSDK3 do with DEMO, I have succeeded. But actually added to the project. Will encounter this problem.
Reply:
3rd floor, the actual operation will be automatically deleted.
Reply:
reference to the third floor tf110012 reply:
locSDK3.SO copy directly into the line, android.mk being without any modification, because mk is compiled. When used, the equivalent of an index, which is used to specify compile c file, and then generate so files, but since it is. so, the documentation has been compiled, and do not need to re-compile, as to why will be smaller, because In the. mk file specifies compile a locSDK3.SO, it will delete the existing namesake so compiled, re-compiled, and may not have any corresponding jni c files or you ......
Do not mislead the people are good, you want a tripartite library, do not change. mk how to use the tripartite library, if he wrote. c file, there are three parties to use the library interface directly compile time error. Also, there is no key depends on whether the landlord of the same name generated. Names of the same name so and tripartite library
Reply:
reference to the 6th floor lsk0372 reply:
reference to the third floor tf110012 reply: locSDK3.SO copy directly into the line, android.mk being without any modified because. mk is used at compile time, the equivalent of an index, which is used to specify compile c file, and then generate so files, but since it is. so, the documentation has been compiled, and do not need to re-compile, as Why become smaller, because. mk file specifies compile a locSDK3.SO, it will delete the existing namesake so compiled, re-compiled ......

Well, did not see it replied, not with third-party libraries on my side, but the direct use of the underlying colleagues write c code for the project, and has compiled a direct copy into it with the ~ ~ ~
Reply:
reference to the 7th floor tf110012 reply:
reference to the 6th floor lsk0372 reply: Quote third floor tf110012 reply: locSDK3.SO copy directly into the line, android . mk being without making any changes, because. mk is used at compile time, the equivalent of an index, which is used to specify compile c file, and then generate so files, but since it is. so, the documentation has been compiled, no need to compile, as to why will be smaller, because. mk file specifies compile a locSDK3.SO, compile-time ......
sorry, I speak a little heavy, apologies apology
Reply:
I do not have the same name as the file you want and locSDK3.SO. There is no documentation and locSDK3.SO is the same name.
Reply:
2nd and 3rd floor of God, and I also think the locSDK3.SO 5K is regenerated. Or regenerate a locSDK3.SO according to God's instructions on the second floor.
Reply:
 

LOCAL_PATH: = $ (call my-dir)


include $ (CLEAR_VARS)

LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = prebuilt/liblocSDK3.so
include $ (PREBUILT_SHARED_LIBRARY)

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
include $ (CLEAR_VARS)
# Here we give our modules name and source file (s)

LOCAL_MODULE: = aaa
LOCAL_SRC_FILES: = aaa.c
include $ (BUILD_SHARED_LIBRARY)

include $ (CLEAR_VARS)
# Here we give our modules name and source file (s)

LOCAL_MODULE: = aaaInit
LOCAL_SRC_FILES: = aaaInit.c
include $ (BUILD_SHARED_LIBRARY)

include $ (CLEAR_VARS)
# Here we give our modules name and source file (s)

LOCAL_MODULE: = aaaMainActivity
LOCAL_SRC_FILES: = aaaMainActivity.c
include $ (BUILD_SHARED_LIBRARY)

include $ (CLEAR_VARS)
# Here we give our modules name and source file (s)

LOCAL_MODULE: = aaaMailService
LOCAL_SRC_FILES: = aaaMailservice.c
include $ (BUILD_SHARED_LIBRARY)

include $ (CLEAR_VARS)
# Here we give our modules name and source file (s)

LOCAL_MODULE: = aaaMail
LOCAL_SRC_FILES: = aaaMail.c
include $ (BUILD_SHARED_LIBRARY)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
include $ (CLEAR_VARS)
LOCAL_SHARED_LIBRARIES: = locSDK3


The above is the content of the file under jni directory android.mk or regenerate locSDK3.so. Therefore, only 5K.
Reply:
First, give the landlord said under ah, not regenerate, is installed, this action is generated because the prebuilt because you are the future of this library will use c and java code, so will install
But read this. Mk file landlord, does not seem to find you use locSDK3.so tripartite library ah?
LOCAL_SHARED_LIBRARIES: = locSDK3 This sentence represents what you want to reference libraries tripartite statement, but you have to clear the variables used in the previous include $ (CLEAR_VARS), ah, is a separate module of the
Anyway, I read your file, just know that you generated libaaa.so three libraries, three-way calling and did not find your library
Reply:
Ask lsk0372, that right android.mk how to write ah
Reply:
If you previously pointing me in front of MK document put part of it is called.
Reply:
In this way, I'll give you to the URL you see, I do not, then keep looking, rest assured, this is simple, just a script it
http://blog.csdn.net/zhandoushi1982/article/details/5316669
Reply:
Strong support is now on the third floor is the right to say, oh, I tried! !
Reply:
After earth approach I use, I generated myself SO file, put ECLIPSE set to not automatically compile SO file, and then add to the mix a third party SO file
Reply:
cited 17 floor Oo_Oo_ reply: After
earth approach I use, I SO generates its own file, put ECLIPSE set to not automatically compile SO files, SO file and then add a third party to come
how eclipse will generate so documents? so file with gcc (linux systems) and ndk-build (android systems) compiler generated, eclipse default is compiled with jdk
Reply:
Alas, the problem I wasted two days, the whole project card here.
Reply:
Reply 16 floor, your project has its own additional documents do SO, SO is automatically compile it? Of course, maybe I have a place to improve. Do not understand why delete liblocSDK3.so. In fact, when I started, that is a direct COPY into armeabi folder, but was deleted, was forced to change the MK files. DEMO inside because I do not have MK documents need only direct COPY into ARMEBI.
Reply:
If you go directly to the test, do not want to be deleted, remove the following code:
include $ (CLEAR_VARS)

LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = liblocSDK3.so
include $ (PREBUILT_SHARED_LIBRARY
This is regenerated
Reply:
I'm here to help you feel you're not appreciate
Reply:
lsk0372, for your help in the office, playing mind grateful. Disrespectful words, if the Department, hope to understand.
Reply:
Seem to get. Without additional generation MK, SO third parties to file COPY JNI directory. Then at the end of JNI directory
MK files added include $ (CLEAR_VARS)LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = locSDK3.so


include $ (PREBUILT_SHARED_LIBRARY).
Because I had to put liblocSDK3.so COPY JNI directory instead locSDK3.so. So reported File not found.

Thank lsk0372, tf110012 and everybody's pointing.
Reply:
Will be able to paste the contents of the final document Android.mk out?
Reply:
reference to the 24th floor bbjyczy reply:
seem to get. Without additional generation MK, SO third parties to file COPY JNI directory. Then at the end of JNI directory
MK files added include $ (CLEAR_VARS)LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = locSDK3.so


include $ (PREBUILT_SHARED_LIBRARY).
Because I had to put liblocSDK3.so COPY JNI directory instead locSDK3.so. So reported File not found.

Thank lsk0372, tf110012 and everybody's pointing.


Positive solution!! Atmosphere this discussion really good ~ ~
Reply:
You can not paste a complete way. . . Do not understand
Reply:
My project itself will generate a file so you need to add two third-party copy files directly into the project so will automatically delete the two files I get saved into a file by modifying mk file so when the program is running, but will be reported so files to find less. . . Landlord adults can help answer
Reply:
By, we must reply to what, otherwise insufficient to calm my excitement, and finally get TMD, an afternoon check plus a crazy night found all kinds of information. This post is a very tricky posted my early discovery, but unfortunately it is Andrews white, new to the week before in the VS development, porting to xcode, inside mk really do not understand something.
The answer is a new online most under prebuilt in jni folder, so copy the file into in a new Android.mk contents inside
 LOCAL_PATH: = $ (call my-dir) 
include $ (CLEAR_VARS)
LOCAL_MODULE: = xxx
LOCAL_SRC_FILES: = xxx.so
include $ (PREBUILT_SHARED_LIBRARY)

Then on the outside, is Android.mk JNI directory add
LOCAL_SHARED_LIBRARIES: = xxx (xxx is the last mk in LOCAL_MODULE)
Then add in the final
include $ (LOCAL_PATH) / prebuilt / Android.mk
Modification, operation, compile, however. More white, do not understand the error message.
Repeated toss, decided by the landlord solutions, so placed directly under jni, ie with Android.mk in the same path.
Also toss, or compile error, unless I put the last one include $ (PREBUILT_SHARED_LIBRARY) changed include $ (BUILT_SHARED_LIBRARY). Can be compiled, but so severely shrunk into 5K.

Changed back to the former method, a close look at the error, the problem seems to be the path, I found my mk in two sentences have so
$ (Call import-add-path, E :/ cocos2d-x-2.2) \
$ (Call import-add-path, E :/ cocos2d-x-2.2/cocos2dx/platform/third_party/android/prebuilt) \
Is this two changed LOCAL_PATH value
When using include $ (LOCAL_PATH) / prebuilt / Android.mk, find the path.
Meanwhile LOCAL_SHARED_LIBRARIES: = XXX phrase should be included in
include $ (CLEAR_VARS)
LOCAL_SHARED_LIBRARIES: = xxx
include $ (PREBUILD_SHARED_LIBRARY)

Finally completed, the perfect copy to armeabi folder.
As the landlord solutions, I tried, successfully or not, I do not know what the problem, time constraints, no effort to get another temporary

No comments:

Post a Comment