ricardoalcocer / appc_book_code

This repository contains all the source code for the book Build Native Cross-Platform Apps with Appcelerator. For more information about the book, visit http://buildmobileapps.io.
10 stars 13 forks source link

Error running Alloy Conference code #3

Closed ricardoalcocer closed 8 years ago

ricardoalcocer commented 9 years ago

Compiling the code for CH6 with TI SDK 4.0.0.RC5 gives the following error after launching the app:

[ERROR] TiApplication: (main) [317,317] Sending event: exception on thread: main msg:java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12; Titanium 4.0.0,2015/05/18 15:42,9239ff9
[ERROR] TiApplication: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12
[ERROR] TiApplication:  at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:464)
[ERROR] TiApplication:  at com.astuetz.viewpager.extensions.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:156)
[ERROR] TiApplication:  at com.astuetz.viewpager.extensions.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:115)
[ERROR] TiApplication:  at com.astuetz.viewpager.extensions.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:111)
[ERROR] TiApplication:  at com.navid.tabs.PagerTabsView.<init>(PagerTabsView.java:55)
[ERROR] TiApplication:  at com.navid.tabs.PagerTabsView.<init>(PagerTabsView.java:86)
[ERROR] TiApplication:  at com.navid.tabs.PagerTabsProxy.createView(PagerTabsProxy.java:40)
[ERROR] TiApplication:  at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:483)
[ERROR] TiApplication:  at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:469)
[ERROR] TiApplication:  at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:507)
[ERROR] TiApplication:  at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:491)
[ERROR] TiApplication:  at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:469)
[ERROR] TiApplication:  at ti.modules.titanium.ui.widget.tabgroup.TiUIAbstractTab.getContentView(TiUIAbstractTab.java:58)
[ERROR] TiApplication:  at ti.modules.titanium.ui.widget.tabgroup.TiUIActionBarTab$TabFragment.onCreateView(TiUIActionBarTab.java:47)
[ERROR] TiApplication:  at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
[ERROR] TiApplication:  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
[ERROR] TiApplication:  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
[ERROR] TiApplication:  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
[ERROR] TiApplication:  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
[ERROR] TiApplication:  at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
[ERROR] TiApplication:  at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
[ERROR] TiApplication:  at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
[ERROR] TiApplication:  at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
[ERROR] TiApplication:  at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
[ERROR] TiApplication:  at android.view.View.measure(View.java:16497)
[ERROR] TiApplication:  at org.appcelerator.titanium.view.TiCompositeLayout.constrainChild(TiCompositeLayout.java:398)
[ERROR] TiApplication:  at org.appcelerator.titanium.view.TiCompositeLayout.onMeasure(TiCompositeLayout.java:278)
[ERROR] TiApplication:  at android.view.View.measure(View.java:16497)
[ERROR] TiApplication:  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
[ERROR] TiApplication:  at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
[ERROR] TiApplication:  at android.view.View.measure(View.java:16497)
[ERROR] TiApplication:  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
[ERROR] TiApplication:  at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
[ERROR] TiApplication:  at android.view.View.measure(View.java:16497)
[ERROR] TiApplication:  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
[ERROR] TiApplication:  at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
[ERROR] TiApplication:  at android.view.View.measure(View.jav
[ERROR] TiApplication:  at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
[ERROR] TiApplication:  at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
[ERROR] TiApplication:  at android.view.View.measure(View.java:16497)
[ERROR] TiApplication:  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
[ERROR] TiApplication:  at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
[ERROR] TiApplication:  at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
[ERROR] TiApplication:  at android.view.View.measure(View.java:16497)
[ERROR] TiApplication:  at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1916)
[ERROR] TiApplication:  at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1113)
[ERROR] TiApplication:  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1295)
[ERROR] TiApplication:  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
[ERROR] TiApplication:  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
[ERROR] TiApplication:  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
[ERROR] TiApplication:  at android.view.Choreographer.doCallbacks(C

I'm suspecting this error has to do with the ViewPager module not being updated. I didn't write that module so I'll refactor the code to use this one instead: https://github.com/manumaticx/pagingcontrol .

The contents of the chapter will remain relevant, except for the part where I explain how to add modules and use the ViewPager in particular. The "add module" procedure is the same for any other module.

ricardoalcocer commented 9 years ago

Due to changes on the Android SDK, I had to refactor the App. Explanation and link to the refactored code can be found here: https://github.com/ricardoalcocer/appc_book_code/wiki/Refactoring-the-Conference-App