I need to have a jar file located in the main / assets directory in an Android project. It is important that the jar file is there.
In my main Android project, is there a way to reference this jar file in my code and use its classes?
To be clear, I do not want to add a jar to the main project after compilation.
EDIT . I tried the link below and it seems to be loading the class file I was talking about. But I'm trying to define constructor arguments for a dynamically loaded class.
android-custom-class-loading-sample
EDIT2
Almost there. I confirmed that the class is loaded from my .jar class. I am stuck creating it though.
In the line licenseValidatorClazz.getConstructor, I get the error below. I assume that I have something missing in the interface file?
java.lang.NoSuchMethodException: [interface com.google.android.vending.licensing.Policy, interface com.google.android.vending.licensing.DeviceLimiter, interface com.google.android.vending.licensing.LicenseCheckerCallback, int, java class .lang.String, class java.lang.String]
public Class licenseValidatorClazz = null; public LicenseValidator validator; ...
I have an interface that contains functions for navigating to a loaded class.
public interface LicenseValidator { public LicenseCheckerCallback getCallback(); public int getNonce(); public String getPackageName(); public void verify(PublicKey publicKey, int responseCode, String signedData, String signature); public void handleResponse(int response, ResponseData rawData); public void handleApplicationError(int code); public void handleInvalidResponse(); }