Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24262] Android : Crash when Try to remove view from parents.

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-01-12T09:30:18.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsregression
ReporterDongwoo Gim
AssigneeGary Mathews
Created2016-12-23T09:33:33.000+0000
Updated2017-01-12T17:44:09.000+0000

Description

6.1.0.v20161222061413 click event has error, singletap is ok. Test code
var win = Ti.UI.createWindow({});

var scrollView = Ti.UI.createScrollView({
  layout: 'vertical'
});
var view1 = Ti.UI.createView({
  backgroundColor:'red', top: 10, height: 200, width: 1000
});
var view2 = Ti.UI.createView({
  backgroundColor:'blue', top: 10, height: 200, width: 1000
});
scrollView.add(view1);
scrollView.add(view2);
win.add(scrollView);
win.open();

view1.addEventListener('click', function() {
  // error
  scrollView.remove(view1);
});
view2.addEventListener('singletap', function() {
  // ok
  scrollView.remove(view2);
});
Error message
[ERROR] TiApplication: (main) [5747,6000] Sending event: exception on thread: main msg:java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.appcelerator.titanium.proxy.TiViewProxy.hierarchyHasListener(java.lang.String)' on a null object reference; Titanium 6.1.0,2016/12/22 06:14,undefined
[ERROR] TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.appcelerator.titanium.proxy.TiViewProxy.hierarchyHasListener(java.lang.String)' on a null object reference
[ERROR] TiApplication: 	at org.appcelerator.titanium.view.TiUIView$7.onSingleTapConfirmed(TiUIView.java:1607)
[ERROR] TiApplication: 	at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:300)
[ERROR] TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] TiApplication: 	at android.os.Looper.loop(Looper.java:148)
[ERROR] TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:5417)
[ERROR] TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Comments

  1. Sharif AbuDarda 2016-12-23

    Hello, What is the Android version you are trying on? I just tested your sample code in Android 6.0.1 device with SDK 6.0.1.GA. The app works as expected. Both view was removed successfully. Thanks.
  2. Dongwoo Gim 2016-12-23

    I was wroten. Titanium SDK 6.1.0.v20161222061413. I know GA build is ok.
  3. Sharif AbuDarda 2016-12-27

    Hello, Use the GA release for your development. Thanks.
  4. Gary Mathews 2017-01-03

    master: https://github.com/appcelerator/titanium_mobile/pull/8726
  5. Samir Mohammed 2017-01-12

    Verified fixed, Error no longer occurs on the latest build of the SDK. *Environment*
       Appcelerator Command-Line Interface, version 6.1.0
       Android 7.1 (Google Nexus 6P)
       Operating System Name: Mac OS X El Capitan
       Operating System Version: 10.11.6
       Node.js Version: 4.6.0
       npm: 4.2.8
       Titanium SDK Version: 6.1.0.v20170112013001
       Xcode: 8.0
       Appcelerator Studio: 4.8.1.201612050850
       

JSON Source