Members of God,
I have a project in 3 SO files, which files are to write three SO C language then generated. Of course, successful. Nothing to say.
The problem is, I now want to refer BAIDU of locSDK3.SO, ie GPRS. I ask how to add it? I direct locSDK3.SO into armeabi folder will be deleted. How does the process 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 two: Add
behind android.mk file in the directory jniinclude $ (CLEAR_VARS)
LOCAL_SHARED_LIBRARIES: = prebuilt / locSDK3
include $ (LOCAL_PATH) /prebuilt/Android.mk
At this time 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 = & gt; libs / armeabi / liblocSDK3.so
I think this is a problem. Because I do 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're 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 at jni a Android.mk (general engineering are like, next jni a Android.mk), and then add your code to the beginning of prebuilt most mk file, but to a change directory: LOCAL_SRC_FILES: = prebuilt / liblocSDK3.so, then a change on the line:
LOCAL_SHARED_LIBRARIES: = prebuilt / locSDK3 to
LOCAL_SHARED_LIBRARIES: = locSDK3
This time you compile, will pass, I did
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 directly copy into the line, android.mk being without any changes, because when used .mk is compiled, the equivalent of an index, which is used to specify the compile c file, and then generate so files, and since is .so, the documentation has been compiled, and do not need to compile, as to why become smaller, because the designated compile a locSDK3.SO in .mk file, the compiler when it will be available with the same name so removed, re-compiled, but may not have any correspondence jni c files or you do not specify which files to compile, so the file so almost no actual data
Reply:
LocSDK3 do with Baidu DEMO, I have succeeded. But actually added to the project. I encountered this problem.
Reply:
3rd floor, the actual operation will be automatically deleted.
Reply:
Do not mislead people is good, you want to refer to the tripartite library which does not change with the tripartite .mk how the library, if he wrote .c files have to use the interface tripartite libraries, compile-time error directly. Also, there is no same name, the same name as the key to see the name of the landlord and constituents whether resulting .so libraries
Reply:
Well, I did not see it replied, I am here not with third-party libraries, but the direct use of the underlying colleagues write c code for the project, and has compiled a direct copy into it with a ~ ~ ~
Reply:
Sorry, I speak a little bit heavier, apology ,apologize
Reply:
I do not have the same name as the file you want and locSDK3.SO. No documents and locSDK3.SO is the same name.
Reply:
2nd and 3rd floor of God, I also think the 5K locSDK3.SO 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 under jni directory android.mk file, or regenerate locSDK3.so. Therefore, only 5K.
Reply:
First to the landlord that the next ah, not regenerate, is installed, this action is because prebuilt produced, because this library your future c and java code will be used, it will install
But I saw the landlord of the .mk file, find that you did not seem to use locSDK3.so this tripartite library ah?
LOCAL_SHARED_LIBRARIES: = locSDK3 this sentence indicates is that you want to reference libraries tripartite statement, but you have to clear the variables used in the previous include $ (CLEAR_VARS), ah, but also a separate module of the
In short, I read your file, just know that you generated libaaa.so three libraries, and did not find the library you call constituents
Reply:
Ask lsk0372, that right android.mk how to write ah
Reply:
If you have previously urged me, in front of the MK file put call part of it.
Reply:
Thus, I give you to the URL you see, is not the case continue to look for me, rest assured that this simple, just a script it
http://blog.csdn.net/zhandoushi1982/article/details/5316669
Reply:
Strong support is now on the third floor that is the right Oh, I tried! !
Reply:
After earth approach I use, I generated myself SO file, put ECLIPSE is set to not automatically compile SO file, then add to the mix to third SO file
Reply:
how eclipse will generate so documents? so the file is to use gcc (linux systems) and ndk-build (android systems) compiler generated, eclipse default compiled with jdk
Reply:
Well, the problem I delayed two days, the whole project card here.
Reply:
Reply to the 16th floor, your project has its own file do other SO, SO is automatically compile it? Of course, maybe I have a place to improve. I do not understand why delete liblocSDK3.so. In fact, when I started, that is, directly into armeabi COPY folder, but is deleted, no alternative but to change the MK file. Because I do not have DEMO in MK file, you only need direct COPY into ARMEBI.
Reply:
If you go direct examination, you do not want to be deleted, it removed the following code:
include $ (CLEAR_VARS)
LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = liblocSDK3.so
include $ (PREBUILT_SHARED_LIBRARY
This is regenerated
Reply:
I can help you here, you feel you're not appreciate
Reply:
lsk0372, place for your help, playing mind grateful. If verbal disrespect, hope can understand.
Reply:
It seems to get. Without additional generation MK, third-party file COPY SO to JNI directory. Then at the end of JNI directory
MK files add include $ (CLEAR_VARS)LOCAL_MODULE: = locSDK3
LOCAL_SRC_FILES: = locSDK3.so
include $ (PREBUILT_SHARED_LIBRARY).
I had to because the liblocSDK3.so COPY JNI directory instead locSDK3.so. So the newspaper can not find the file.
Thanks lsk0372, tf110012 and everybody's pointing.
Reply:
You will be able to last Android.mk file content posted out?
Reply:
Positive Solutions !! This discussion really great atmosphere ~
Reply:
You can not paste a complete way. . . can not read it
Reply:
My project itself will generate a file so you need to add two third-party so files copied directly into the project will take two files I deleted automatically saved into a file by modifying the mk file so when the program is running but will be reported so the file to find less. . . Landlord adults can help to answer
Reply:
By, we must reply to what, or else not enough to calm my excitement, TMD finally get a crazy afternoon, plus one night to check a variety of information search. This post is a very tricky stick my early detection, but unfortunately it is Andrews white, new to the week before in the VS development, porting to xcode, really do not understand something inside mk.
The answer is the new online most at prebuilt in jni folder, so the file copy entry in the new contents inside a Android.mk
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 LOCAL_MODULE)
Then add in the final
include $ (LOCAL_PATH) /prebuilt/Android.mk
Modification is completed, run the compiler, but. Whiter, read the error message.
Repeated toss, the landlord decided to solutions, so directly under jni, namely with Android.mk in the same path.
And toss, or compile error, unless I put the last one include $ (PREBUILT_SHARED_LIBRARY) changed include $ (BUILT_SHARED_LIBRARY). It can be compiled, but so severely diminished, become 5K.
And in exchange for the former method, a close look at the error, the problem seems to be the path, I found there are so
mk two sentences$ (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, changing the value
LOCAL_PATHWhen using include $ (LOCAL_PATH) /prebuilt/Android.mk, find the path.
Meanwhile LOCAL_SHARED_LIBRARIES: = XXX sentence 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 solution, I tried, still did not succeed, I do not know what the problem is, time constraints, no energy to get another temporary
Reply:
Ask you, I would like to quote an image processing library, file name libfreeimage.so, I will file directly into the jni directory, which is Android.mk, but the compiler errors ask you what's wrong.
# Android.mk
LOCAL_PATH: = $ (call my-dir)
include $ (CLEAR_VARS)
LOCAL_MODULE: = GISView
LOCAL_CFLAGS: = - Werror
LOCAL_C_INCLUDES: = $ (LOCAL_PATH) / jni
LOCAL_C_INCLUDES + = $ (LOCAL_PATH) ../android-ndk-r9/sources/cxx-stl/stlport
LOCAL_SRC_FILES: = com_example_test_GisGlobeLib.cpp \
RenderingEngine.TexturedES2.cpp \
TileSet.cpp \
Tile.cpp \
Camera.cpp \
Task.cpp
LOCAL_LDLIBS: = - llog -lGLESv2 -L $ (SYSROOT) / usr / lib
#LOCAL_SHARED_LIBRARIES: = Freeimage
include $ (BUILD_SHARED_LIBRARY)
include $ (CLEAR_VARS)
LOCAL_MODULE: = freeimage
LOCAL_SRC_FILES: = libfreeimage-3.15.4.so
include $ (PREBUILT_SHARED_LIBRARY)
Reply:
LOCAL_PATH: = $ (call my-dir)
include $ (CLEAR_VARS)
LOCAL_MODULE: = txpay
LOCAL_SRC_FILES: = prebuilt / $ (TARGET_ARCH_ABI) /libtxpay.so
include $ (PREBUILT_SHARED_LIBRARY)
include $ (CLEAR_VARS)
LOCAL_MODULE: = game_shared
LOCAL_MODULE_FILENAME: = libgame
#traverse all the directory and subdirectory
define walk
$ (Wildcard $ (1)) $ (foreach e, $ (wildcard $ (1) / *), $ (call walk, $ (e)))
endef
#traverse Classes Directory
ALLFILES = $ (call walk, $ (LOCAL_PATH) /../../ Classes)
FILE_LIST: = hellocpp / main.cpp
FILE_LIST + = $ (LOCAL_PATH) /../../ Classes / sql / sqlite3.c
FILE_LIST + = $ (filter% .cpp, $ (ALLFILES))
FILE_INCLUDES: = $ (shell find $ (LOCAL_PATH) /../../ Classes -type d)
#source file will be compiled
LOCAL_SRC_FILES: = $ (FILE_LIST: $ (LOCAL_PATH) /% =%)
LOCAL_C_INCLUDES: = $ (LOCAL_PATH) /../../../ external / Box2D / \
$ (FILE_INCLUDES) \
LOCAL_WHOLE_STATIC_LIBRARIES: = cocos2dx_static cocosdenshion_static cocos_extension_static box2d_static
include $ (BUILD_SHARED_LIBRARY)
$ (Call import-module, CocosDenshion / android) \
$ (Call import-module, cocos2dx) \
$ (Call import-module, extensions) \
$ (Call import-module, external / Box2D)
Get it posted yesterday, spent a long time agonizing, and found no more than mk, one on the line, simply add the code at the 3-7 line can be, but also to put the front, rear discharge not
prebuilt / $ (TARGET_ARCH_ABI) of prebuilt is jni in new prebuilt files, in fact, was built not built indifferent, prebuilt there are four folders: armeabi, armeabi-v7a, mips, x86, stood each folder different architectures The libtxpay.so library, $ (TARGET_ARCH_ABI) is automatically selected according to cpu architecture armeabi, armeabi-v7a, mips, x86 architecture in these libraries, my test is in default only copy armeabi libtxpay.so library in application. mk add APP_ABI: = armeabi armeabi-v7a after, it will also copy armeabi armeabi-v7a library
Find out in this regard online search are mostly the same content, to put it is not very clear, so his own harvest stickers
Rare reply. . .
Reply:
31 F methods are available, simple, thanks about
Reply:
Will the landlord how to import multiple libraries so android.mk in a document? ?
Reply:
Consult this example android5.0 source Why are compiled, but under the direct mmm compiled tips No rule to make target
development \ ndk \ tests \ prebuilt-library \ jni
Reply:
31 F methods are available, simple, thanks about
No comments:
Post a Comment