ericwlange / AndroidJSCore

AndroidJSCore allows Android developers to use JavaScript natively in their apps.
468 stars 78 forks source link

Support of API < 19 #9

Closed skvav closed 8 years ago

skvav commented 8 years ago

Is this constraint critical? It would be great to use library with API >= 9. I tried to override minSdkVersion, but on API 9 my app crashes with error "Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1311]: 798 cannot locate ' log2'..." that seemed to be fixed in your fork of WebView https://github.com/ericwlange/webkit/commit/9c5abf1835bcd0287715eb09a4c1c2e39d07ab12, but maybe it's wasn't included in version 2.0.

ericwlange commented 8 years ago

I compiled with API 19. I had attempted to build with API 16 because I wanted to test on a MIPS configuration I had in the emulator, but for some reason, although it built, it would not run. I didn't spend any more time on it and reverted back to API 19. Feel free to try and build with a lower API. You can achieve that by editing the following dictionary in scripts/build:

ANDROID_APIS = {
    'armeabi'     : '19',
    'armeabi-v7a' : '19',
    'arm64-v8a'   : '21',
    'x86'         : '19',
    'x86_64'      : '21',
    'mips'        : '19',
    'mips64'      : '21'
}

Change it to whichever API you want.

You will then need to change minSdkVersion in AndroidJSCore/build.gradle to whatever you've changed it to. Then run the build script.

Let me know how it goes. If it works for lower APIs, I will put it in the next release. At the moment, I am working on trying to get the 64-bit architectures to work, and JIT on ARM. Those are my goals for version 2.1. Will include the lower API if it works.

a112121788 commented 8 years ago

Here is my test on android(4.0,4.1 4.2 4.3). Only 26.83% passed. the main reason is because of log2.... so I use another one android-jsc on my test ,84% passed.

My partner found the project have some problem because of Memory leak。 He have resolved。but he does not know how to contact with you . echarts

ericwlange commented 8 years ago

This is great. I can be contacted in any number of ways. If you want to email me, please send to eric at flicket dot tv. Otherwise you can raise a pull request. Would love to see what memory leaks have been uncovered!

ericwlange commented 8 years ago

The head version now works with API 16+ (min Jellybean). At the moment, I don't have any plans to go back further because older APIs use an older version of the standard template libraries, but JavaScriptCore requires a newer version. According to Google, API 16+ should cover 94% of devices in the wild. When I release 2.1, this support will be there. Should be in the next couple of days. But in the interim, you can build from source.

ericwlange commented 8 years ago

This issue is now fixed in 2.1. API 16+ is now supported. As noted above, I don't plan to add support pre- API 16, as it would require a much older build of webkit, and it is not worth it for the 6% of devices that still require it.