Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6637] Android: Snackbar error using Hyperloop

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNot Our Bug
Resolution Date2020-12-01T16:07:19.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsHyperloop, Titanium SDK & CLI
Labelsandroid, hyperloop, snackbar
ReporterJorge Macias Garcia
AssigneeJoshua Quick
Created2020-11-30T14:54:29.000+0000
Updated2020-12-01T16:07:19.000+0000

Description

Android Snackbar doesn't works properly with latest versions (SDK - Hyperloop). As you can see (and test) in the attached example it throws an error when "show" method is executed. PD: It works fine using (Ti SDK 9.0.3.GA - Hyperloop 5.0.3) *Testing error table* 9.0.3 - 5.0.3 - Works 9.1.0 - 6.0.3 - Error 9.1.0 - 5.0.3 - Error 9.2.2 - 5.0.3 - Error 9.2.2 - 6.0.3 - Error
const Snackbar = require('com.google.android.material.snackbar.Snackbar');

function doClick(e) {
  const parent = $.getView();
  const snackbar = Snackbar.make(parent, 'Here we go!', Snackbar.LENGTH_LONG);

  snackbar.show();
}

$.index.open();
{noformat} [ERROR] HyperloopProxy: (main) [151952,157866] Unable to resolve method call. Class: com.google.android.material.snackbar.Snackbar, method name: make, args: [ti.modules.titanium.ui.WindowProxy@2405f12, Here we go!, null] [ERROR] TiExceptionHandler: (main) [2,157868] /alloy/controllers/index.js:58 [ERROR] TiExceptionHandler: snackbar.show(); [ERROR] TiExceptionHandler: ^ [ERROR] TiExceptionHandler: TypeError: Cannot read property 'show' of null [ERROR] TiExceptionHandler: at Label.doClick (/alloy/controllers/index.js:58:14) [ERROR] TiExceptionHandler: at Label.value (ti:/events.js:50:21) [ERROR] TiExceptionHandler: at Label.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:977) [ERROR] TiExceptionHandler: org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1206) [ERROR] TiExceptionHandler: org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:262) [ERROR] TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiExceptionHandler: android.os.Looper.loop(Looper.java:223) [ERROR] TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:7656) [ERROR] TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method) [ERROR] TiExceptionHandler: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) [ERROR] V8Exception: Exception occurred at /alloy/controllers/index.js:58: Uncaught TypeError: Cannot read property 'show' of null {noformat}

Attachments

FileDateSize
SnackbarApp.zip2020-11-30T14:53:45.000+00008663307

Comments

  1. Joshua Quick 2020-11-30

    This is caused by a breaking-change in Google's library. You need to make the following change in your code... https://github.com/appcelerator/hyperloop-examples/commit/00f4c1d20747ee5adfacbf2d0cb26dba644c8a43
  2. Jorge Macias Garcia 2020-12-01

    It works again. Thank you very much @jquick I appreciate your help.

JSON Source