Giter VIP home page Giter VIP logo

apk64's Introduction

Apk64

About

APK64 is a simple tool to modify APK files in java. I wrote this to use in my game engine for export projects as APK by using a pre-compiled template.

How to use

First of all, you need an apk file to modify, but plaese note that APK64 can't apply changes to the original code of the APK. It can only change its metadata, such as the name, package, version, icon and other details.

...

File templateFile = ...;  // APK to modify
File outputDir = ...;     // Temporary output directory
File keyStoreFile = ...;  // KeystoreFile (can be created with FileUtils.createKeystore)
File outputFile = ...;    // Output APK file

int bufferSize = 1024; // You can increase to get faster (but don't overdo it!)
Apk64 apk64 = new Apk64(bufferSize); // Buffer size is optional

// Create and apply configurations
Apk64Configs configs = new Apk64Configs();
configs.setTemplateFile(templateFile);
configs.setOutputDir(outputDir);
configs.setKeyStoreFile(keyStoreFile, "alias", "android");
configs.setOutputFile(outputFile);
apk64.setConfigs(configs);	
		
apk64.loadTemplate(); // Start modidding APK

/* Do your changes here */

apk64.finish();       // Finish modding APK
...

Standard changes

Apk64 has a few standard changes that you can do with the APK:

  • Rename application
  • Rename package
  • Replace icon
  • Replace resources (like drawables and mipmaps)
  • Add and remove permissions
  • Change version name and version code
  • Inject assets

Bellow you can view a full example for all standard changes:

...
apk64.loadTemplate();

// Rename application
apk64.changeAppName("MyApp");

// Rename package
apk64.changePackage("com.your.package");

// Replace icon
apk64.replaceAppIcon(newIconFile);

// Replace resources (like drawables and mipmaps)

// With automatic extensions:
apk64.replaceDrawable("icon", newIconFile); 
apk64.replaceMipmap("icon", newIconFile); 
apk64.replaceResource("xml", "xml-file", newXMLFile);

// Specific file
apk64.replaceResource("drawable-hdpi-v4/icon.png", newIconFile); 

// Add and remove permissions
apk64.addPermission("WRITE_EXTERNAL_STORAGE");
apk64.addCustomPermission("com.package.custom.PERMISSION");

apk64.removePermission("WRITE_EXTERNAL_STORAGE");
apk64.removeCustomPermission("com.package.custom.PERMISSION");

// Change version name and version code
apk64.changeVerion(12, "1.2 mod");

// Inject assets
apk64.addToAssets(assetFile1, assetFile2, assetFile3, ... ); // You can pass multiple files and folders here

apk64.finish();
...

Th'rd part libs

apk64's People

Contributors

raffa064 avatar

Stargazers

Gabriel Aplok avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.