daimajia / NumberProgressBar

A beautiful, slim Android ProgressBar.
MIT License
6.07k stars 1.4k forks source link

java.lang.NoSuchFieldError: com.daimajia.numberprogressbar.R$attr.numberProgressBarStyle #7

Closed Reza-Rg closed 10 years ago

Reza-Rg commented 10 years ago

I've tried adding library to my project. I am facing some problem, I clicked 'Syns now', and I also downloaded library locally and added it to project, and ... I've tried every thing but I still got this error, any advice ?

    09-07 02:03:34.091    2976-2976/com.ghaleh.minifc E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ghaleh.minifc/com.ghaleh.minifc.activities.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class com.daimajia.numberprogressbar.NumberProgressBar
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
            at android.app.ActivityThread.access$600(ActivityThread.java:123)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class com.daimajia.numberprogressbar.NumberProgressBar
            at android.view.LayoutInflater.createView(LayoutInflater.java:606)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at com.ghaleh.minifc.activities.Drawer1.onCreateView(Drawer1.java:102)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:828)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
            at android.app.BackStackRecord.run(BackStackRecord.java:622)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
            at android.app.Activity.performStart(Activity.java:4501)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
            at android.app.ActivityThread.access$600(ActivityThread.java:123)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.reflect.InvocationTargetException
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:586)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at com.ghaleh.minifc.activities.Drawer1.onCreateView(Drawer1.java:102)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:828)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
            at android.app.BackStackRecord.run(BackStackRecord.java:622)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
            at android.app.Activity.performStart(Activity.java:4501)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
            at android.app.ActivityThread.access$600(ActivityThread.java:123)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NoSuchFieldError: com.daimajia.numberprogressbar.R$attr.numberProgressBarStyle
            at com.daimajia.numberprogressbar.NumberProgressBar.<init>(NumberProgressBar.java:167)
            at java.lang.reflect.Constructor.constructNative(Native Method)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
            at android.view.LayoutInflater.createView(LayoutInflater.java:586)
            at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
            at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
            at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
            at com.ghaleh.minifc.activities.Drawer1.onCreateView(Drawer1.java:102)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:828)
            at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
            at android.app.BackStackRecord.run(BackStackRecord.java:622)
            at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
            at android.app.Activity.performStart(Activity.java:4501)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
            at android.app.ActivityThread.access$600(ActivityThread.java:123)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4424)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
            at dalvik.system.NativeStart.main(Native Method)'
daimajia commented 10 years ago

Hey, guy. Are you using Gradle? I tested just now, it works well.

Reza-Rg commented 10 years ago

Hi, Yes. I am using Gradle. I also had this problem with v.1.1 and I thought may be v.1.2 fixed it, but same error. I also have some other libraries which are working fine, and I have problem only with this one. :|

daimajia commented 10 years ago

It's weird, can you sync successfully?

Reza-Rg commented 10 years ago

Yes, Android Studio Syncs successfully with no problem. I tried it on two different projects, both ended "force close" by same error.

daimajia commented 10 years ago

Could you paste your code and layout xml here? I guess it's not the library error..

Reza-Rg commented 10 years ago

Here it is:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.ghaleh.minifc.activities.Drawer1">
...
    <com.daimajia.numberprogressbar.NumberProgressBar
    android:id="@+id/powerbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="20dp"
    style="@style/NumberProgressBar_Default"
    app:max = "100"
    app:progress = "80"/>
...
</LinearLayout>

and I have nothing related to "powerbar" id in my code. for more info "Drawer1" extends Fragment and that is all.

daimajia commented 10 years ago

Hey, did you download the jar version and put it into the libs folder?

daimajia commented 10 years ago

I have an idea. You can make a test project.

Reza-Rg commented 10 years ago

I tried:

compile 'com.daimajia.numberprogressbar:library:1.2@aar'

and after facing error I downloaded libs folder added in my "libraries" folder and add this line to setting.gradle:

include ':libraries:android_ago'
include ':libraries:paper_style'
include ':libraries:number_progressbar'

and finally added this line to build.gradle:

...
compile project(':libraries:number_progressbar')

but I got same error.

daimajia commented 10 years ago

I want to remotely help you to solve this problem, shall we?

daimajia commented 10 years ago

using TeamViewer share your desk.

Reza-Rg commented 10 years ago

Thank you! Thats nice of you. Just let me download TeamViewer.

daimajia commented 10 years ago

Share we start?

Reza-Rg commented 10 years ago

OK, Thanks again ID: 235 918 013 Pass: 7191

daimajia commented 10 years ago

Password invalid...

daimajia commented 10 years ago

You can try to run the first empty project in simulator... check if it works

daimajia commented 10 years ago

Hey, a new quick way:

https://github.com/daimajia/NumberProgressBar/blob/master/library%2Fsrc%2Fmain%2Fjava%2Fcom%2Fdaimajia%2Fnumberprogressbar%2FNumberProgressBar.java#L167

change

this(context, attrs, R.attr.numberProgressBarStyle);

to

this(context, attrs, null);

please have a try.

daimajia commented 10 years ago

Sorry that I removed the project from lib folder. You may need git it again and modify it.

Reza-Rg commented 10 years ago

Not a problem. I'll check it now. and let you know.

daimajia commented 10 years ago

Mistake.

should be 0 instead of null.

this(context, attrs, 0);
Reza-Rg commented 10 years ago

You are a genius! :) Actually I used

this(context, attrs, 0);

and it worked :)

daimajia commented 10 years ago

oh, great!

daimajia commented 10 years ago

Ok, i'll do some other changes, before publish new version.

enjoy it.

Reza-Rg commented 10 years ago

That was great. I really appreciate you for helping me. Thats kind of you. Thanks again.

github11221 commented 7 years ago

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.daimajia.numberprogressbar.NumberProgressBar