Convert jar to apk

Convert JAR to APK

Turn compatible Java code into a signed Android APK, with limits for desktop and Java ME JAR files.

Convert JAR files online

We don’t have a dedicated online converter for JAR to APK yet, but you can convert JAR files online to these formats:

How to convert jar to apk file

An Android device, emulator, or enterprise deployment system may require an installable .apk when the software you have is a Java .jar. This is usually a porting and Android build task, not a file-extension change.

What a JAR file contains

A JAR (Java Archive) is a ZIP-based container used by Java developers for libraries, desktop applications, command-line tools, and some older Java ME software. It normally contains Java .class files, resources, and metadata under META-INF; Maven, Gradle, Eclipse, IntelliJ IDEA, and the JDK jar tool commonly produce JAR files.

An executable desktop JAR often declares a Main-Class in META-INF/MANIFEST.MF and starts through a standard Java runtime. A library JAR provides reusable code without an application entry point. Neither type inherently provides Android components, Android resources, a usable AndroidManifest.xml, or an Android signing configuration.

What an APK file contains

An APK is an Android application package. It contains DEX bytecode for Android Runtime (ART), an Android manifest, compiled resources, optional native libraries, and package signatures.

Its practical advantages are that Android can install it directly, verify its signing certificate, and identify its declared activities, services, permissions, and supported devices. For new public Google Play submissions, use an Android App Bundle (.aab) instead; Google Play generates device-specific APKs from the bundle.

Check the JAR before attempting a build

With a JDK installed, list the archive contents:

jar tf input.jar

Look for META-INF/MANIFEST.MF, Java package directories, resources, and dependencies. A JAR using Swing, AWT, JavaFX, a desktop main() method, unrestricted local file paths, or platform-specific desktop libraries cannot be made into a working Android app by repackaging it.

A JAR that is only a general-purpose library may be usable in an Android project. A complete desktop application normally requires its source code to be adapted for Android.

Build an Android APK from source code

  1. Install Android Studio and install the required SDK platform through Tools → SDK Manager.
  2. Create an Android project through File → New → New Project. Select Java if the existing code is Java; Kotlin is also supported but is not required for the migration.
  3. Move reusable Java code into the app module, usually app/src/main/java. Replace a desktop main() entry point with an Android Activity, service, receiver, or other declared Android component.
  4. Replace desktop UI code with Android views, layouts, or Jetpack Compose; Android does not provide Swing, AWT, or JavaFX as a desktop Java runtime does.
  5. Adapt storage, networking, notifications, background work, and permissions to Android APIs. For example, network access requires <uses-permission android:name="android.permission.INTERNET" /> in the project manifest.
  6. Set the application ID, minimum SDK version, target SDK version, icons, resources, and manifest components. Test on an emulator and real devices with the Android versions you support.
  7. Create a debug APK with ./gradlew assembleDebug on macOS/Linux or gradlew.bat assembleDebug on Windows. The usual output is app/build/outputs/apk/debug/app-debug.apk.
  8. Create a release APK from Build → Generate Signed Bundle / APK → APK. Sign it with a keystore you control and preserve the keystore, alias, and passwords.

Use a compatible JAR as a library

Copy a library JAR to app/libs and add it to the app module's Gradle dependencies:

implementation(files("libs/library.jar"))

The Android Gradle Plugin converts compatible Java class files to DEX during the build. Add required third-party dependencies separately through Gradle; do not assume every dependency used by the original JAR is embedded in it or works on Android.

Java ME JAR files and online converters

Older Java ME games and applications commonly use a .jar plus an optional .jad descriptor. J2ME Loader can run many of them through emulation, but it does not convert the original program into a native standalone APK. A native Android version requires source code and an Android rewrite.

No reputable online service can reliably convert an arbitrary JAR into a functional APK because Android entry points, UI, permissions, dependencies, and API replacements are application-specific. Avoid upload-based “one-click” converters, especially for proprietary code; they cannot safely create a maintainable app or retain exclusive control of your release-signing key.

Compatibility and release limits

ART executes DEX, not ordinary JVM class files. D8 can translate compatible bytecode, but it does not make Java SE desktop APIs available on Android. JARs compiled for an unsupported Java class-file version may need to be rebuilt from source; some language features and libraries require Android desugaring or Android-specific replacements.

Reflection, dynamically loaded classes, code shrinking, native libraries, and device-specific CPU architectures need explicit build configuration and testing. Decompiled code can sometimes help recover a lost project, but it may be incomplete, hard to maintain, and restricted by the software license.

An installed app can be updated only with the same application ID and signing key. Changing either causes Android to treat the APK as a different application rather than an update.

JAR vs APK: format comparison

How the JAR and APK formats compare on the properties that matter most for this conversion.

Comparison of the JAR and APK file formats
Property .JAR Java Archive .APK Android Package
Open standard Yes No
Compression Both Both
Typical file size Medium Medium
Opens in a web browser No No
Further editing Limited Not directly editable
Metadata support Basic Basic
Plain-text readable No No
Best used for Embedding in applications Embedding in applications
Introduced 1996 2008
Developer Oracle (originally Sun Microsystems) Google
MIME type application/java-archive application/vnd.android.package-archive

Frequently asked questions

Can I convert a JAR file directly to an APK?

Usually not; a JAR is a Java archive, while an APK is an Android application package with Android-specific compiled code, resources, and configuration. A JAR generally needs to be ported or rebuilt for Android rather than simply renamed or repackaged.

Will my JAR code work after converting it to an APK?

Only if the code is compatible with Android and has an Android application structure added around it. JARs that depend on desktop Java APIs, unsupported libraries, or native components may require source-code changes or replacement dependencies.

Can I convert the APK back to the original JAR?

You may be able to extract some Java-related code or resources, but the original JAR structure and source code are not guaranteed to be recoverable. Android compilation, resource processing, optimization, and signing can change or remove information.