Currently trying to build my own Xposed module, but got a issue that project can't see my dependencies with that error:
/home/***/AndroidStudioProjects/MyApplication/app/src/main/java/com/example/myapplication/MainHook.java:3: error: package de.robv.android does not exist
import static de.robv.android.xposed.IXposedHookLoadPackage;
^
/home/***/AndroidStudioProjects/MyApplication/app/src/main/java/com/example/myapplication/MainHook.java:3: error: static import only from classes and interfaces
import static de.robv.android.xposed.IXposedHookLoadPackage;
^
/home/***/AndroidStudioProjects/MyApplication/app/src/main/java/com/example/myapplication/MainHook.java:6: error: cannot find symbol
public class MainHook implements IXposedHookLoadPackage {
^
symbol: class IXposedHookLoadPackage
/home/***/AndroidStudioProjects/MyApplication/app/src/main/java/com/example/myapplication/MainHook.java:7: error: method does not override or implement a method from a supertype
@Override
^
That's my MainHook code:
package com.example.myapplication;
import static de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class MainHook implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equalsIgnoreCase("com.my.another.application")) return;
XposedBridge.log("Loaded app: " + lpparam.packageName);
}
}
How to make AndroidStudio to see that package and use it?
What I did:
dependencies {
compileOnly 'de.robv.android.xposed:api:82'
compileOnly 'de.robv.android.xposed:api:82:sources'
}
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
tools:targetApi="31" >
<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="Please, Omnissian, let me build it" />
<meta-data
android:name="xposedminversion"
android:value="53" />
<meta-data
android:name="xposedscope"
android:resource="@array/xposedscope"/>
</application>
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://api.xposed.info/' }
}
}
assets
and added file xposed_init
inside with that content:com.example.myapplication.MainHook
Gradle can see that package: image1
I redid the same things, by copying configs from here and built project with such errors:
Cannot resolve symbol 'IXposedHookLoadPackage'
Cannot resolve symbol 'XposedBridge'
Cannot resolve symbol 'XC_LoadPackage'
Cannot resolve symbol 'XC_MethodHook'
But LSPosed just accepted it and module is working. Seems like the problem was in AndroidStudio, so to be sure if your code doesn't work you need to try this on device first.