ndk-samples
ndk-samples copied to clipboard
how can i make a .a file into aar prefab offered by none current building?
you mean how to publish your library in an AAR? you might look at the the prefab-publishing sample, and the official documentation.
you mean how to publish your library in an AAR? you might look at the the prefab-publishing sample, and the official documentation.
I hava run the demo prefab-publishing,But cant make a ref .a file none this build coversation to aar!
add_library(libtool STATIC IMPORTED) set_target_properties(libtool PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libtool.a) file(GLOB native_srcc "${CMAKE_SOURCE_DIR}/*.cpp")
add_library( native-lib STATIC ${native_srcc} ${Scaffolding} ) target_link_libraries( native-lib libtool android z log)
like this cmamelist.txt config 'native-lib.a' can build in arr but the 'libtool.a ' left! the aar cant use
you do not need to pack libtool.a, because static lib pulls in all needed code into the final static native-lib already.
for shared lib though, "Each Module has its own headers and at most one library per target platform." as documented in the wiki page, "Package Structure" section. To workaround this you will need to do one of followings:
- make 2 AARs ( one for each shared lib. For the libraries that you only have binaries, you could NOT use prefab to generate AAR, but ndkport or other tools, or even manually pack an AAR, AAR is just a zip file ).
- make 2 modules inside one AAR: you have to use ndkport or other tools to do packing.
may you check it out?
Are you sure the head line ? As a matter of fact, native-lib.a just contains the code ${native_srcc} ${Scaffolding} had no 'libtool.a'!
As the below of the head line by other tools, Whats the meaning of the feature of AGP prfab?I think, I and all other developers do not want to do anything by leaving android studio !
Adding @DanAlbert to the thread.
Actually I am not sure: I tried, and you are right, the static lib's object code are not combined into native-lib.a. For static libraries, target_link_libraries() has no use since there is no link stage at all.
Now coming back to the original question: yeah you will have to distribute the original static lib ( unless you combine the libs).
Then it falls into the same track as the shared libs path: the current implementation will not help for that, filed a bug to track it: technically every add_library() statement inside the CMakeLists.txt should be able to be added, as a module, to the same AAR; I agree with you on the fact that I like to avoid using many different tools to do the similar work, and if I have IDE open, I like to finish all of work inside IDE.
let's track it from that bug. For now, looks like that you will have to workaround it with manual way for imported libraries.
Aha. So pride of the agreement with Google Android team members! I feel im flying now!
@Efaker , please add your input to that bug to make sure they are considered, and keep track on that one: this one will be closed soon if no objections. I will update the official documentation to reflect the what the current expected behaviors are.