Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Override the Built-in Library #9

Open
steven-cheng opened this issue Nov 4, 2021 · 4 comments
Open

Unable to Override the Built-in Library #9

steven-cheng opened this issue Nov 4, 2021 · 4 comments

Comments

@steven-cheng
Copy link

I want to use a newer version of a class that its older version is provided by the built-in library, because it has a new method that the older version doesn't have. I placed the newer version of the class (in jar format) in the lib/deps/ directory, but the compiler failed to compile. The error message said there was no such method to call, so that clearly indicates the compiler is still referring to the older version.

I've found there is two ways to overcome this problem. One is deleting the older version in the lib/appinventor/ directory. Another is directly moving the newer version into the the lib/appinventor/ directory and replacing the older version.

The compilation is successful when using either way above. But when the resulting .aix file is imported and used to build an Android App, and when this app calls the method in question, the same error message appears, saying no such method.

So, the app seems still calling the older version instead of the new one, and my problem is not completely solved. I would like to know if there is a way to override the built-in library during the app building phase too?

@ewpatton
Copy link
Member

It really depends on the library. If it's a library used in an optional component you can do it if and only if end users don't include the component in question. Otherwise, you will always encounter an issue, specifically because the dex utility provided by the Android toolchain insists that only one instance of a class be included in the final binary (even if the two files are byte-for-byte equivalent).

@steven-cheng
Copy link
Author

Sorry, which ones are the optional components? Where can I find the definition? By the way, what I need to replace is a class inside the lib/appinventor/core.jar . So, from its name "core.jar", it seem not to be optional at all, right?

@vknow360
Copy link

Form is for example a core component.If a jar is included in it then only option left to you to work with that lib is to repackage the jar.

@patryk84a
Copy link

Also before recompiling, delete the "build" folder. I noticed that sometimes the information in this folder affects builds despite changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants