I'd like to use few hidden properties in my project and I am able to do it if I replace the default $SDK_PATH/platforms/android-27/android.jar
for android.jar
with exposed properties but every time I want to work on this project, I need to manually replace that android.jar file for another and then replace it for the original one.
I've found there's a way to include the exposed android.jar
file via gradle (source e.g.: here) by adding it to its dependencies. So I've done it:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compileOnly files('platform/android-27/android.jar')
implementation 'com.android.support:appcompat-v7:27.1.1'
}
I can do gradle sync, gradle can see the file but building the project fails with error: cannot find symbol variable INSTALL_REPLACE_EXISTING
.
The code I'm using the variable (constant actually) in:
File file = new File(apkPath);
pm.installPackage(Uri.fromFile(file), observer, PackageManager.INSTALL_REPLACE_EXISTING, "com.example.pminstaller");
Please, what else should I do to make it work?
EDIT: I've moved a bit with this problem. I can find classes like EthernetManager, which are hidden in default SDK but I can't use hidden methods from classes which are not hidden in default SDK. After adding android.jar file with hidden API, the project have two classes with the same package name and it selects the default one.
How can I force gradle to select the hidden one?