public void addNativeLibraries ( File nativeFolder ) throws ApkCreationException , SealedApkException , DuplicateFileException { if ( mIsSealed ) { throw new SealedApkException ( "APK is already sealed" ) ; } if ( ! nativeFolder . isDirectory ( ) ) { // not a directory? check if it's a file or doesn't exist if ( nativeFolder . exists ( ) ) { throw new ApkCreationException ( "%s is not a folder" , nativeFolder ) ; } else { throw new ApkCreationException ( "%s does not exist" , nativeFolder ) ; } } File [ ] abiList = nativeFolder . listFiles ( ) ; verbosePrintln ( "Native folder: %s" , nativeFolder ) ; if ( abiList != null ) { for ( File abi : abiList ) { if ( abi . isDirectory ( ) ) { // ignore files File [ ] libs = abi . listFiles ( ) ; if ( libs != null ) { for ( File lib : libs ) { // only consider files that are .so or, if in debug mode, that // are gdbserver executables if ( lib . isFile ( ) && ( PATTERN_NATIVELIB_EXT . matcher ( lib . getName ( ) ) . matches ( ) || PATTERN_BITCODELIB_EXT . matcher ( lib . getName ( ) ) . matches ( ) || ( mDebugMode && SdkConstants . FN_GDBSERVER . equals ( lib . getName ( ) ) ) ) ) { String path = SdkConstants . FD_APK_NATIVE_LIBS + "/" + abi . getName ( ) + "/" + lib . getName ( ) ; try { doAddFile ( lib , path ) ; } catch ( IOException e ) { mBuilder . cleanUp ( ) ; throw new ApkCreationException ( e , "Failed to add %s" , lib ) ; } } } } } } } }
Adds the native libraries from the top native folder . The content of this folder must be the various ABI folders .