Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26329] Hyperloop: Android - Can't instantiate a CoordinatorLayout in SDK 7.3.0

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-08-23T23:48:57.000+0000
Affected Version/sRelease 7.3.0
Fix Version/sRelease 7.3.1
ComponentsAndroid, Hyperloop
Labelsandroid, hyperloop
ReporterLuc-Edmond Gaspard
AssigneeJoshua Quick
Created2018-08-20T22:16:11.000+0000
Updated2018-08-24T09:30:27.000+0000

Description

Hi, since 7.3.0 this example does not work anymore. https://github.com/appcelerator/hyperloop-examples/blob/master/app/controllers/android/nativelayout.js And if I try to create a CoordinatorLayout directly in hyperloop or in a java module I get this exception:
(main) [222,5668] Exception during instantiation of class 'android.support.design.widget.CoordinatorLayout'
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/coreui/R$attr;

Comments

  1. Rakhi Mitro 2018-08-21

    Hello, Thanks for sharing with us. It would be great if you can share a simple test case to reproduce this on our end.
  2. Luc-Edmond Gaspard 2018-08-21

       const Activity = require('android.app.Activity');
       const CoordinatorLayout = require("android.support.design.widget.CoordinatorLayout");
       const Color = require('android.graphics.Color');
       
       const win = Ti.UI.createWindow();
       const activity = new Activity(Ti.Android.currentActivity);
       
       const layout = new CoordinatorLayout(activity);
       layout.setBackgroundColor(Color.YELLOW);
       win.add(layout);
       
       win.open();
       
    When running with 7.3.0.GA : {noformat} (main) [83,149] Exception during instantiation of class 'android.support.design.widget.CoordinatorLayout' java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/coreui/R$attr; at android.support.design.widget.CoordinatorLayout.(CoordinatorLayout.java:202) at android.support.design.widget.CoordinatorLayout.(CoordinatorLayout.java:198) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at hyperloop.ClassProxy.newInstance(ClassProxy.java:89) at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:183) at org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:247) at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:135) at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:190) at org.appcelerator.titanium.TiRootActivity.windowCreated(TiRootActivity.java:171) at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:675) at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:176) at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:160) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.coreui.R$attr" on path: DexPathList[[zip file "/data/app/test.test.test-PaJox8-SBb_08twvLLYZMA==/base.apk"],nativeLibraryDirectories=[/data/app/test.test.test-PaJox8-SBb_08twvLLYZMA==/lib/x86, /data/app/test.test.test-PaJox8-SBb_08twvLLYZMA==/base.apk!/lib/x86, /system/lib, /system/vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) ... 26 more {noformat}
  3. Hans Knöchel 2018-08-21

    Your issue is different to what your comments state. The issue above is about missing attr values in your project that are required to instantiate a CoordinatorLayout programmatically. But if the example from the hyperloop-examples repo does not work anymore, it'd be an actual regression. We need to investigate in that direction. *EDIT*: Here is the actual error:
       [ERROR] TiExceptionHandler: (main) [30081,30386] /hyperloop/android.view.LayoutInflater.js:390
       [ERROR] TiExceptionHandler: 	var result = this.$native.callNativeFunction({
       [ERROR] TiExceptionHandler:                            ^
       [ERROR] TiExceptionHandler: Error: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
       [ERROR] TiExceptionHandler:     at LayoutInflater.inflate (/hyperloop/android.view.LayoutInflater.js:390:28)
       [ERROR] TiExceptionHandler:     at /alloy/controllers/nativelayout.js:51:806
       [ERROR] TiExceptionHandler:     at new Controller (/alloy/controllers/nativelayout.js:51:882)
       [ERROR] TiExceptionHandler:     at Object.exports.createController (/alloy.js:339:9)
       [ERROR] TiExceptionHandler:     at ListView.onListViewItemclick (/alloy/controllers/index.js:114:31)
       [ERROR] TiExceptionHandler:     at ListView.value (ti:/events.js:49:21)
       [ERROR] TiExceptionHandler:     at ListView.value (ti:/events.js:101:19)
       [ERROR] TiExceptionHandler:
       [ERROR] V8Exception: Exception occurred at /hyperloop/android.view.LayoutInflater.js:390: Uncaught Error: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout
       
    It may be related to the support-library update we did in 7.3.0? Renaming the support library could fix it. cc [~jquick] for a 2nd thought.
  4. Christopher Williams 2018-08-22

    Just to confirm, I was able to use the example in question with 7.2.0.GA and it is broken on 7.3.0.GA and the latest 7_3_X builds of the SDK. The error message is not very helpful, but certainly Hans' suggestion regarding the updated support libraries is also my suspicion: * https://github.com/appcelerator/titanium_mobile/commit/53da13c4fe * https://github.com/appcelerator/titanium_mobile/commit/86e84eeb39
  5. Joshua Quick 2018-08-23

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10279
  6. Joshua Quick 2018-08-23

    PR (7.4.x): https://github.com/appcelerator/titanium_mobile/pull/10281 PR (7.3.x): https://github.com/appcelerator/titanium_mobile/pull/10282
  7. Lokesh Choudhary 2018-08-23

    FR Passed. PR's merged.
  8. Samir Mohammed 2018-08-24

    *Closing ticket.* verified fix in SDK version 7.5.0.v20180823165211, 7.4.0.v20180823165354 and 7.3.1.v20180823165225. Test and other information can be found at: Master: https://github.com/appcelerator/titanium_mobile/pull/10279 7.4.X: https://github.com/appcelerator/titanium_mobile/pull/10281 7.3.X: https://github.com/appcelerator/titanium_mobile/pull/10282

JSON Source