{"id":13749148,"url":"https://github.com/appcelerator-archive/appc-aar-tools","last_synced_at":"2025-05-09T12:30:29.610Z","repository":{"id":48279119,"uuid":"80017605","full_name":"appcelerator-archive/appc-aar-tools","owner":"appcelerator-archive","description":"NodeJS tools for working with Android Archive (.aar) files","archived":false,"fork":false,"pushed_at":"2021-08-03T17:16:29.000Z","size":1186,"stargazers_count":8,"open_issues_count":16,"forks_count":5,"subscribers_count":13,"default_branch":"develop","last_synced_at":"2024-08-03T07:02:59.856Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appcelerator-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-25T13:37:00.000Z","updated_at":"2024-08-03T07:02:59.857Z","dependencies_parsed_at":"2022-09-16T02:50:37.073Z","dependency_job_id":null,"html_url":"https://github.com/appcelerator-archive/appc-aar-tools","commit_stats":null,"previous_names":["appcelerator/appc-aar-transform","appcelerator/appc-aar-tools"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Fappc-aar-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Fappc-aar-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Fappc-aar-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appcelerator-archive%2Fappc-aar-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appcelerator-archive","download_url":"https://codeload.github.com/appcelerator-archive/appc-aar-tools/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224859694,"owners_count":17381676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T07:00:56.081Z","updated_at":"2024-11-15T23:32:08.530Z","avatar_url":"https://github.com/appcelerator-archive.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Android Archive Tools for NodeJS\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/appcelerator/appc-aar-tools.svg)](https://greenkeeper.io/)\n\nSet of tools to work with Android Archive (.aar) files outside of the Gradle build pipeline.\n\n## Installation\n`npm install appc-aar-tools`\n\n## Usage\nThis module is used to extract the contents of an Android Archive (.aar) to a desired location and optionally copy any bundled assets and libraries to a new location. It can also regenerate the R.java class file from the R.txt that is included in Android Archives.\n\n### Extract Android Archive\n\nExtracting an Android Archive and optionally copying assets and libraries to a new location can be done using the `AarTransformer` class.\n\n\u003e Note: All paths are expected to be absolute (you can use `path.join()` for that).\n\n```js\nvar AarTransformer = require('appc-aar-tools').AarTransformer;\nvar transformer = new AarTransformer(logger) // logger is optional, can be any bunyan based logger\n\nvar options = {\n  aarPathAndFilename: '/path/to/file.aar',\n  outputPath: '/path/to/dist',\n  assetsDestinationPath: '/path/to/assets',\n  libraryDestinationPath: '/path/to/lib',\n  sharedLibraryDestinationPath: '/path/to/jni'\n};\n\ntransformer.transform(options, function(err, result) {\n  console.log(result.explodedPath); // full path to the exploded archive folder\n  console.log(result.packageName); // package key from AndroidManifest.xml\n  console.log(result.jars); // array of JAR files found in the Android Archive\n  console.log(result.nativeLibraries); // array of native libraries (.so) found in the Android Archive\n});\n```\n\nAll available options for the `transform()` method are described in the following table.\n\n| Option | Type | Description |\n|--------|------| ------------|\n| `aarPathAndFilename` | String | The path and filename pointing to the .aar file to process. |\n| `outputPath` | String | Base directory where the .aar file will be extracted to. The actual content will be extracted into a sub-directory (basename of the AAR file). |\n| `assetsDestinationPath` | String | (Optional) Copy all assets contained in the .aar to this path. |\n| `libraryDestinationPath` | String | (Optional) Copy all libraries (.jar) contained in the .aar to this path. |\n| `sharedLibraryDestinationPath` | String | (Optional) Copy all shared libraries (.so) contained in the .aar to this path. |\n\n### Generate R.java\n\nGenerating the `R.java` from a `R.txt` is handled by the `SymboldLoader` and `SymbolWriter` classes.\n\nSymbols from a `R.txt` file can be loaded by the `SymbolLoader`\n```js\nvar SymbolLoader = require('appc-aar-tools').SymbolLoader;\nvar librarySymbols = new SymbolLoader('/path/to/exploded/archive/R.txt');\nlibrarySymbols.load();\n```\n\nThose symbols can then be added to the `SymbolWriter` which will generate a `R.java` based on the symbols found. In addition to the library symbols the `SymbolWriter` requires the full symbol values to be passed to its constructor. This simply is a `SymbolLoader` instance which loaded the `R.txt` file that was generated by the `AAPT` command line tool from all merged resources using the `--output-text-symbols` option.\n```js\nvar SymbolLoader = require('appc-aar-tools').SymbolLoader;\nvar SymbolWriter = require('appc-aar-tools').SymbolWriter;\nvar fullSymbolValues = new SymbolLoader('/path/to/symbol/file/from/aapt/R.txt')\nfullSymbolValues.load();\nvar outputPath = '/output/path';\nvar packageName = 'com.library.package.name';\nvar symbolWriter = new SymbolWriter(outputPath, packageName, fullSymbolValues);\nsymbolWriter.addSymbolsToWrite(librarySymbols);\nsymbolWriter.write();\n```\nAfter calling the `write()` method the generated file will be saved under a sub-folder in the output path which is based on the package name. In the above example that would be `/output/path/com/library/package/name/R.java`\n\n## Contributing\n\nThis is an open source project. Please consider forking this repo to improve,\nenhance or fix issues. If you feel like the community will benefit from your\nfork, please open a pull request.\n\nTo protect the interests of the contributors, Appcelerator, customers\nand end users we require contributors to sign a Contributors License Agreement\n(CLA) before we pull the changes into the main repository. Our CLA is simple and\nstraightforward - it requires that the contributions you make to any\nAppcelerator open source project are properly licensed and that you have the\nlegal authority to make those changes. This helps us significantly reduce future\nlegal risk for everyone involved. It is easy, helps everyone, takes only a few\nminutes, and only needs to be completed once.\n\n[You can digitally sign the CLA](http://bit.ly/app_cla) online. Please indicate\nyour e-mail address in your first pull request so that we can make sure that\nwill locate your CLA. Once you've submitted it, you no longer need to send one\nfor subsequent submissions.\n\n## License\n\nThis project is open source and provided under the [Apache Public License\n(version 2)](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)).\n\nCopyright (c) 2017, [Appcelerator](http://www.appcelerator.com/) Inc. All Rights Reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator-archive%2Fappc-aar-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappcelerator-archive%2Fappc-aar-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappcelerator-archive%2Fappc-aar-tools/lists"}