Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6459] java.lang.NoSuchMethodError: No super method internalSetPadding(IIII)V

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsHyperloop, Titanium SDK & CLI
Labelsandroid
ReporterLawrence Wilson
AssigneeNazmus Salahin
Created2019-12-20T14:13:23.000+0000
Updated2020-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)

Comments

  1. Nazmus Salahin 2019-12-23

    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
  2. Lawrence Wilson 2020-01-07

    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.
  3. Michael Gangolf 2020-01-07

    Do you have to use that syntax?
       (function() {
       	const Activity = require('android.app.Activity');
       	const FrameLayout = require('android.widget.FrameLayout');
       	const LayoutParams = require('android.widget.FrameLayout.LayoutParams');
       	const ViewGroupLayoutParams = require('android.view.ViewGroup.LayoutParams');
       	const Gravity = require('android.view.Gravity');
       
       	const _activity = new Activity(Ti.Android.currentActivity);
       	const main = new FrameLayout(_activity);
       	main.setLayoutParams(new LayoutParams(ViewGroupLayoutParams.MATCH_PARENT, ViewGroupLayoutParams.MATCH_PARENT, Gravity.TOP));
       
       })();
       
    works fine (like in the hyperloop-example repo) with 28 or 29.
  4. Lawrence Wilson 2020-01-07

    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
  5. Michael Gangolf 2020-01-07

    Ah ok, I see. More details about the error: Looking at the generated build/hyperloop/android/js/android.widget.FrameLayout.js the line var result = subclassProxy.newInstance(arguments) is false. So the result.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))
  6. Lawrence Wilson 2020-01-17

    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?
  7. Lawrence Wilson 2020-02-07

    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:
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->createSnapshot(Landroid/view/ViewDebug$CanvasProvider;Z)Landroid/graphics/Bitmap; (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->destroyHardwareResources()V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/widget/FrameLayout;->encodeProperties(Landroid/view/ViewHierarchyEncoder;)V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->internalSetPadding(IIII)V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->notifySubtreeAccessibilityStateChangedIfNeeded()V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->createSnapshot(Landroid/view/ViewDebug$CanvasProvider;Z)Landroid/graphics/Bitmap; (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->destroyHardwareResources()V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/widget/FrameLayout;->encodeProperties(Landroid/view/ViewHierarchyEncoder;)V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->internalSetPadding(IIII)V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->notifySubtreeAccessibilityStateChangedIfNeeded()V (dark greylist, linking)
       [WARN] :   W/dingplanner.ap: Accessing hidden method Landroid/view/ViewGroup;->internalSetPadding(IIII)V (dark greylist, linking)
       [ERROR] :  HyperloopProxy: (main) [2314,26887] 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.V8Object.nativeFireEvent(Native Method)
       [ERROR] :  HyperloopProxy: 	at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
       [ERROR] :  HyperloopProxy: 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:975)
       [ERROR] :  HyperloopProxy: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1204)
       [ERROR] :  HyperloopProxy: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:267)
       [ERROR] :  HyperloopProxy: 	at android.os.Handler.dispatchMessage(Handler.java:102)
       [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)
       [ERROR] :  TiExceptionHandler: (main) [2,26889] /hyperloop/android.widget.FrameLayout.js:99
       [ERROR] :  TiExceptionHandler: 		result.setOverrides(modified);
       [ERROR] :  TiExceptionHandler:          ^
       [ERROR] :  TiExceptionHandler: TypeError: result.setOverrides is not a function
       [ERROR] :  TiExceptionHandler:     at new SubClass (/hyperloop/android.widget.FrameLayout.js:99:10)
       [ERROR] :  TiExceptionHandler:     at Object.exports.createScrollView (/ScrollView.js:798:13)
       [ERROR] :  TiExceptionHandler:     at handleFloorPlanChange (/alloy/controllers/planContent.js:441:44)
       [ERROR] :  TiExceptionHandler:     at new Controller (/alloy/controllers/planContent.js:226:3)
       [ERROR] :  TiExceptionHandler:     at Object.exports.createController (/alloy.js:428:10)
       [ERROR] :  TiExceptionHandler:     at expandThumb (/alloy/controllers/base/planthumb.js:231:16)
       [ERROR] :  TiExceptionHandler:     at View.handlePlanTap (/alloy/controllers/base/planthumb.js:202:5)
       [ERROR] :  TiExceptionHandler:     at View.value (ti:/events.js:50:21)
       [ERROR] :  TiExceptionHandler:     at View.value (ti:/events.js:102:19)
       [ERROR] :  TiExceptionHandler:
       [ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
       [ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:63)
       [ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:975)
       [ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1204)
       [ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:267)
       [ERROR] :  TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:102)
       [ERROR] :  TiExceptionHandler:     android.os.Looper.loop(Looper.java:193)
       [ERROR] :  TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:6669)
       [ERROR] :  TiExceptionHandler:     java.lang.reflect.Method.invoke(Native Method)
       [ERROR] :  TiExceptionHandler:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       [ERROR] :  V8Exception: Exception occurred at /hyperloop/android.widget.FrameLayout.js:99: Uncaught TypeError: result.setOverrides is not a function
       
  8. Joshua Quick 2020-02-08

    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!

JSON Source