[AC-6459] java.lang.NoSuchMethodError: No super method internalSetPadding(IIII)V
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Hyperloop, Titanium SDK & CLI |
Labels | android |
Reporter | Lawrence Wilson |
Assignee | Nazmus Salahin |
Created | 2019-12-20T14:13:23.000+0000 |
Updated | 2020-02-08T03:19:07.000+0000 |
Description
The following code works with SDK 8.3 and the andoid: android:targetSdkVersion=27
(function(){
const Activity = require('android.app.Activity');
const FrameLayout = require('android.widget.FrameLayout');
const _activity = new Activity(Ti.Android.currentActivity);
const _context = _activity.getApplicationContext();
const FrameLayoutView = FrameLayout.extend({});
var _self = new FrameLayoutView(_context);
})();
However, updating the targetSdkVerision to 28 or 29, the following error occurs:
[ERROR] : HyperloopProxy: (main) [1922,2638] Exception during instantiation of class 'android.widget.FrameLayout'
[ERROR] : HyperloopProxy: java.lang.NoSuchMethodError: No super method internalSetPadding(IIII)V in class Landroid/widget/FrameLayout; or its super classes (declaration of 'android.widget.FrameLayout' appears in /system/framework/framework.jar!classes2.dex)
[ERROR] : HyperloopProxy: at FrameLayout_Proxy.internalSetPadding(Unknown Source:47)
[ERROR] : HyperloopProxy: at android.view.View.<init>(View.java:5558)
[ERROR] : HyperloopProxy: at android.view.ViewGroup.<init>(ViewGroup.java:659)
[ERROR] : HyperloopProxy: at android.view.ViewGroup.<init>(ViewGroup.java:655)
[ERROR] : HyperloopProxy: at android.view.ViewGroup.<init>(ViewGroup.java:651)
[ERROR] : HyperloopProxy: at android.view.ViewGroup.<init>(ViewGroup.java:647)
[ERROR] : HyperloopProxy: at android.widget.FrameLayout.<init>(FrameLayout.java:78)
[ERROR] : HyperloopProxy: at FrameLayout_Proxy.<init>(Unknown Source:0)
[ERROR] : HyperloopProxy: at java.lang.reflect.Constructor.newInstance0(Native Method)
[ERROR] : HyperloopProxy: at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
[ERROR] : HyperloopProxy: at hyperloop.ClassProxy.newInstance(ClassProxy.java:89)
[ERROR] : HyperloopProxy: at hyperloop.DynamicSubclassProxy.newInstance(DynamicSubclassProxy.java:30)
[ERROR] : HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModuleBytes(Native Method)
[ERROR] : HyperloopProxy: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModuleBytes(V8Runtime.java:162)
[ERROR] : HyperloopProxy: at org.appcelerator.kroll.KrollRuntime.runModuleBytes(KrollRuntime.java:212)
[ERROR] : HyperloopProxy: at org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:101)
[ERROR] : HyperloopProxy: at org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:480)
[ERROR] : HyperloopProxy: at org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:192)
[ERROR] : HyperloopProxy: at org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:499)
[ERROR] : HyperloopProxy: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)
[ERROR] : HyperloopProxy: at android.app.Activity.performResume(Activity.java:7292)
[ERROR] : HyperloopProxy: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
[ERROR] : HyperloopProxy: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
[ERROR] : HyperloopProxy: at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
[ERROR] : HyperloopProxy: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
[ERROR] : HyperloopProxy: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
[ERROR] : HyperloopProxy: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[ERROR] : HyperloopProxy: at android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] : HyperloopProxy: at android.os.Looper.loop(Looper.java:193)
[ERROR] : HyperloopProxy: at android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] : HyperloopProxy: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : HyperloopProxy: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] : HyperloopProxy: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Hello, Thanks for reporting this issue. Can you please share the steps to reproduce the issue? Did you check the issue on your physical device? Also, please share the *appc info* log here. Thanks
Hi Nazmus, I've provided the code that is failing in the description - just needs to be put in the alloy.js of any project and run against targetSdkVerisions 28 or 29 - also in the description. It also fails on a physical device. The appc info is in the Environment details above. Not sure why you asked for all this as it is all provided.
Do you have to use that syntax?
works fine (like in the hyperloop-example repo) with 28 or 29.
I'm trying to extend it to override the functions - code without any override functions {quote}const FrameLayoutView = FrameLayout.extend({});{quote} and it is this that is causing the error in 28 or 29
Ah ok, I see. More details about the error: Looking at the generated
build/hyperloop/android/js/android.widget.FrameLayout.js
the linevar result = subclassProxy.newInstance(arguments)
is false. So theresult.setOverrides(modified);
is crashing. At least that error appears in the last row of the error you've showed above. Perhaps that helps finding the bug BTW: the max supported version is 28 ([matrix](https://wiki.appcelerator.org/display/guides2/Titanium+Compatibility+Matrix#TitaniumCompatibilityMatrix-AndroidSDK/TargetAndroidplatform))On further investigation, I can see that before 8.3.0 release, a change was made to compile with sdk 29 (which is not supported), see history: https://github.com/appcelerator/titanium_mobile/commits/8_3_X/android/package.json and from Android 10 (sdk 29) has greylisted internalSetPadding(IIII)V, see this page https://developer.android.com/about/versions/10/non-sdk-q#q-list-changes Does this mean 8.3.0 has been compiled and distributed incorrectly?
I've tried looking where I can in order to solve this but getting nowhere. Please could somebody from Appcelerator take a look as I need to release the newer version of the app and this is stopping me doing so. Here are some more logs prior to the crash:
Titanium 8.3.0 and higher *+does+* support targeting API Level 29 (aka: Android Q; aka: Android 10). The docs [here](https://wiki.appcelerator.org/display/guides2/Titanium+Compatibility+Matrix#TitaniumCompatibilityMatrix-AndroidSDK/TargetAndroidplatform) are out-of-date (or we lost the doc change). We'll update it in the near future. When building with Titanium 8.3.0.GA or higher, you need to set the "targetSdkVersion" to 29 (which is the default if you don't set it). This will solve the problem when running on Android Q. If you target 28, then yes it will crash on Android Q. The reason is because targeting API Level 28 tells hyperloop to fetch all public APIs from the Android O library, which includes the blacklisted public/protected APIs (they're still available via reflection). When targeting API Level 29, hyperloop fetches all public/protected APIs from the Android Q library where the blacklisted APIs are no longer available (which is what you want). I also know that hyperloop caches the public APIs found in Google's Android libraries. If you think you're running into a caching issue, then delete your project's "build" directory. I didn't run into any caching issues when switching API Level targets (it always re-loaded the APIs), but that's the only other possible issue that I can think of. I hope this helps!