dmytrodanylyk/android-process-button

Inflate Exception in xml

ram-ap opened this issue · 12 comments

Hai..
I am trying to run your sample project. I got this error. Please help me solve this issue.

07-15 11:26:24.416: E/AndroidRuntime(3195): FATAL EXCEPTION: main
07-15 11:26:24.416: E/AndroidRuntime(3195): Process: com.example.processbutton, PID: 3195
07-15 11:26:24.416: E/AndroidRuntime(3195): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.processbutton/com.example.processbutton.MainActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class com.dd.processbutton.iml.SubmitProcessButton
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.ActivityThread.access$800(ActivityThread.java:139)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.os.Handler.dispatchMessage(Handler.java:102)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.os.Looper.loop(Looper.java:136)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.ActivityThread.main(ActivityThread.java:5086)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at java.lang.reflect.Method.invokeNative(Native Method)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at java.lang.reflect.Method.invoke(Method.java:515)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at dalvik.system.NativeStart.main(Native Method)
07-15 11:26:24.416: E/AndroidRuntime(3195): Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class com.dd.processbutton.iml.SubmitProcessButton
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.createView(LayoutInflater.java:620)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.Activity.setContentView(Activity.java:1937)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.example.processbutton.MainActivity.onCreate(MainActivity.java:16)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.Activity.performCreate(Activity.java:5248)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
07-15 11:26:24.416: E/AndroidRuntime(3195):     ... 11 more
07-15 11:26:24.416: E/AndroidRuntime(3195): Caused by: java.lang.reflect.InvocationTargetException
07-15 11:26:24.416: E/AndroidRuntime(3195):     at java.lang.reflect.Constructor.constructNative(Native Method)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at android.view.LayoutInflater.createView(LayoutInflater.java:594)
07-15 11:26:24.416: E/AndroidRuntime(3195):     ... 23 more
07-15 11:26:24.416: E/AndroidRuntime(3195): Caused by: java.lang.NoClassDefFoundError: com.dd.processbutton.R$styleable
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.dd.processbutton.FlatButton.initAttributes(FlatButton.java:45)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.dd.processbutton.FlatButton.init(FlatButton.java:38)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.dd.processbutton.FlatButton.<init>(FlatButton.java:27)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.dd.processbutton.ProcessButton.<init>(ProcessButton.java:31)
07-15 11:26:24.416: E/AndroidRuntime(3195):     at com.dd.processbutton.iml.SubmitProcessButton.<init>(SubmitProcessButton.java:40)
07-15 11:26:24.416: E/AndroidRuntime(3195):     ... 26 more

@ram-ap are you using AS or Eclipse?

Eclipse.
Thanks for your quick reply I didn't expect that you reply so quick.. & sorry for my late reply..

@ram-ap I am not sing Eclipse, but try to add to your root layout

xmlns:custom="http://schemas.android.com/apk/res/com.dd.processbutton

Multiple annotations found at this line:
- error: No resource identifier found for attribute 'pb_textComplete' in package
'com.dd.processbutton'
- error: No resource identifier found for attribute 'pb_textProgress' in package
'com.dd.processbutton'

It gave compile time error when including the line that you have send.. But this line
"xmlns:custom="http://schemas.android.com/apk/res-auto" works

Check this topic. This is not issue of the library.

ok.. but still i got inflate exception error which i mentioned in my question..

This error occurs

Multiple annotations found at this line:

  • error: No resource identifier found for attribute 'pb_textComplete' in package
    'com.dd.processbutton'

  • error: No resource identifier found for attribute 'pb_textProgress' in package
    'com.dd.processbutton'

    only when i include xmlns:custom="http://schemas.android.com/apk/res/com.dd.processbutton"
    which got resolved when i change res to lib

But I seek your help to resolve Inflate Exception which i got when i try to run your sample project.

Caused by: java.lang.NoClassDefFoundError: com.dd.processbutton.R$styleable

It means it can't find resources. Make sure you have added all res files.

Also are you using ant or gradle ? Try clean an rebuild project.

I am using ant.. Eclipse automatically build project using ant..
These are the steps i follow.

  1. Import both sample and library project in eclipse workspace.
    2.Add your library project as library of sample(So that when i build the sample project eclipse automatically build library project and add jar file to buildpath and i see that jar file got added to my build path)
    3.But when i run this sample project i got this error.
    4.I clean and build the project several times.

My project is gradle based, doest Eclipse changed it to ant based automatically?

Eclipse does not support gradle.. afaik Eclipse do build automattically using ant..
did you give any special condition while build using gradle. ? ok thanks for your help :) .. then let me try AS..