This stacktrace appears when trying to call initializeView() for the first time.
compileSdkVersion 25
buildToolsVersion "25.0.2"
minSdkVersion 21
targetSdkVersion 25
FATAL EXCEPTION: main
Process: bj.draggablepaneltest, PID: 24274
java.lang.RuntimeException: Unable to start activity ComponentInfo{bj.draggablepaneltest/bj.draggablepaneltest.main.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class com.github.pedrovgs.DraggableView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class com.github.pedrovgs.DraggableView
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.github.pedrovgs.DraggableView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:652)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at android.view.View.inflate(View.java:22183)
at com.github.pedrovgs.DraggablePanel.initializeView(DraggablePanel.java:263)
at bj.draggablepaneltest.main.DraggablePanelInitialiser.initaliseDraggablePanel(DraggablePanelInitialiser.java:23)
at bj.draggablepaneltest.main.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 5 to dimension: type=0x12
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:737)
at com.github.pedrovgs.DraggableView.initializeAttributes(DraggableView.java:680)
at com.github.pedrovgs.DraggableView.<init>(DraggableView.java:85)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:652)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at android.view.View.inflate(View.java:22183)
at com.github.pedrovgs.DraggablePanel.initializeView(DraggablePanel.java:263)
at bj.draggablepaneltest.main.DraggablePanelInitialiser.initaliseDraggablePanel(DraggablePanelInitialiser.java:23)
at bj.draggablepaneltest.main.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
This refers to line: this.marginRight = attributes.getDimensionPixelSize(5, 30); and I have tried overriding marginRight in both XML and code.
I have tried copying the sample dimens.xml and using that but it doesn't work. I have tried in both Kotlin and Java.
This stacktrace appears when trying to call
initializeView()
for the first time.This refers to line:
this.marginRight = attributes.getDimensionPixelSize(5, 30);
and I have tried overridingmarginRight
in both XML and code.I have tried copying the sample
dimens.xml
and using that but it doesn't work. I have tried in both Kotlin and Java.