Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Using the Xposed Framework API

rovo89 edited this page May 27, 2016 · 6 revisions

Introduction

Every Xposed modules needs to reference the API. This page describes how this can be done correctly. It should be seen in addition to the Development tutorial.

Android Studio (Gradle-based)

The Xposed Framework API is published on Bintray/jCenter: https://bintray.com/rovo89/de.robv.android.xposed/api
That makes it easy to reference it by simply adding a Gradle dependency in your app/build.gradle:

repositories {
    jcenter();
}

dependencies {
    provided 'de.robv.android.xposed:api:82'
}

It is very important that you use provided instead of compile! The latter would include the API classes in your APK, which can cause issues especially on Android 4.x. Using provided just makes the API classes usable from your module, but there will only be references to them in the APK. The actual implementation will be provided when the user installs the Xposed Framework.

In most cases, the repositories block already exists, and there are usually some dependencies already. In that case, you just need to add the provided line to the existing dependencies block.

There is also documentation available for the API (see below). Unfortunately, I didn't find any good way to enable automatic download of the API sources, except using both of these lines:

provided 'de.robv.android.xposed:api:82'
provided 'de.robv.android.xposed:api:82:sources'

The way Gradle caches the files, Android Studio will set up the second jar as source for the first one automatically. Better recommendations are welcome!

Please make sure to disable Instant Run (File -> Settings -> Build, Execution, Deployment -> Instant Run), otherwise your classes aren't included directly in the APK, but loaded via a stub application which Xposed can't handle.

Eclipse

In Eclipse, you have to download the jar manually from here: https://jcenter.bintray.com/de/robv/android/xposed/api/

I recommend putting the files into a subdirectory called lib. Don't put them into the libs subdirectory! Jar files in libs would automatically make Eclipse compile the API classes into your APK, but they must only be referenced (see above).

Now right-click the api-XX.jar file and select Build Path -> Add to Build Path. That's it! Now you can also add a source assignment (from the api-XX-sources.jar file) in order to see the documentation directly in Eclipse.

API versions

Latest API version badge

Generally, the API version equals the Xposed version that it was built on. However, only some framework changes actually result in API changes, as you can see in the change log. I only publish a new API version when there were API changes, and I try to keep them compatible with existing modules as good as possible. So when you build a module with API version 82, it will most likely also work with Xposed version 90.

I always recommend that end-users use the latest Xposed version, so there's nothing wrong with using the highest API version that's available. You should usually set the xposedminversion in your AndroidManifest.xml to the API version that you use. If you depend on a framework change that didn't cause an API change (e.g. because a certain bug has been fixed), feel free to set you xposedminversion to the least Xposed version that your module requires.

If you want to support ROMs before Lollipop, you can only use API version 53, as the latest Xposed version for Android 4.x was 54. Note that the sources jar provided for this version doesn't match the actual implementation, it only makes the documentation available.

Others

On http://api.xposed.info, you can find the Javadoc for the Xposed Framework API.

If you want to make sure that zip releases or API jars were indeed created by me (rovo89), verify the .asc files with GnuPG.
My master key has the fingerprint 0DC8 2B3E B1C4 6D48 33B4 C434 E82F 0871 7235 F333 (short notation: 7235F333). Releases are signed with the subkey 852109AA.