Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error inflating class info.hoang8f.widget.FButton #41

Open
Abdulwahid80 opened this issue Oct 28, 2017 · 73 comments
Open

Error inflating class info.hoang8f.widget.FButton #41

Abdulwahid80 opened this issue Oct 28, 2017 · 73 comments

Comments

@Abdulwahid80
Copy link

Abdulwahid80 commented Oct 28, 2017

After updating android studio form 2.3.3 to 3.0 I faced this problem
my project was working properly with FButton. when I upgrade android studio then update my project
this problem appears.
Also After modifying build gradle to 2.3.3 the same problem still existed but when I delete google repository form build script repositories and all project repositories it works properly.
I would to know what cause this problem?

@8155220
Copy link

8155220 commented Oct 28, 2017

same here

@8155220
Copy link

8155220 commented Oct 28, 2017

  1. prest Ctrl+Alt+Shift+S
  2. Select project
  3. Change gradle Version to -> 3.3
  4. change Android PLugin version to -> 2.3.3

that work for me

@GoltsevEugene
Copy link

I believe that should be fixed asap.
8155220 - bad idea, you won't use all enhancement in new gradle in such case.

@adhavpavan
Copy link

same issue

@indy1515
Copy link

indy1515 commented Nov 30, 2017

@pranaysharma
What do you add to hot fix the problem?

@Patra89
Copy link

Patra89 commented Dec 6, 2017

Is this issue going to be fixed soon? Also @pranaysharma could you give more details about what I'm I supposed to do to fix this?

@jd-alexander
Copy link

Hey everyone! I fixed it. Use my library as a dependency https://github.com/jd-alexander/android-flat-button

https://jitpack.io/#jd-alexander/android-flat-button/v1.1

@Abdulwahid80
Copy link
Author

thanks @jd-alexander it works properly with modifying button_color to fButtonColor.
it really helps

@abhriyaroy
Copy link

@pranaysharma please could you clarify as to what the fix is? Like, what tags do I add the color hex codes with in the colors.xml file?

@jd-alexander
Copy link

@abhriyaroy just use my dependency in the link above. I changed some stuff with the attributes; naming and type.

@jd-alexander
Copy link

@abhriyaroy if you really wanna see the changes you can also just look on the most recent commit logs by me and the other contributor before.

@abhriyaroy
Copy link

@jd-alexander thank you so much!

@correaricardo
Copy link

@jd-alexander Whoa, what a nice fella.

@useit4me
Copy link

Same as @jd-alexander said. Just rephrasing here. the fix is

  1. Copy the file FButton.java from here -->
    https://github.com/hoang8f/android-flat-button/blob/master/library/src/main/java/info/hoang8f/widget/FButton.java to src/main/java/

  2. In the FButton.java change FButton_buttonColor at the line no
    115 } else if (attr == R.styleable.FButton_buttonColor) to
    } else if (attr == R.styleable.FButton_fButtonColor) {

  3. Copy/Merge the 3 files under the https://github.com/hoang8f/android-flat-button/tree/master/library/src/main/res/values

  4. Make sure the build.gradle (Module) uses the library
    compile 'com.github.jd-alexander:android-flat-button:v1.1'

  5. Make sure build.ggradle (project) has the jipack repository enabled like this
    allprojects { repositories { google() jcenter() maven { url 'https://jitpack.io' } } }

  6. In the activity_main.xml or similar wherever you guys are using the widget info.hoang8f.widget.FButton if you are using the property ButtonColor; change it to fButtonColor

If you have these steps taken care of the build should run fine.

@maribelmai
Copy link

Hello,
I tried to use jd-alexander version but I really cannot change the min sdk version to 17 so I tried the following and it worked for me: Instead of using gradle to import the project, I downloaded it and imported as a module, then referenced the dependency,
I hope it helps

@eyildiz-ugoe
Copy link

I cannot use this since it has some minimum version requirement.

@maribelmai
Copy link

@eyildiz-ugoe check my answer

@maribelmai
Copy link

I think I wasn't clear. The module I imported is https://github.com/hoang8f/android-flat-button/tree/master/library
I didn't use the jd-alexander version

@eyildiz-ugoe
Copy link

Oh okay. I got it totally wrong then. Thanks, I'll use this one.

@ashishdeshpande98
Copy link

Actually sir according to ur guidence I already done with the gradle version and Android plugin version , but after that I had these error
Failed to resolve ' info.hoang8f:Fitting:1.0.5 '
Failed to resolve ' com.rdngwuxian.meterialedittext:library:2.1.4

@takprosto
Copy link

takprosto commented Feb 7, 2018

@jd-alexander
I have this problem:
Failed to resolve: com.github.jd-alexander:android-flat-button:v1.1
How can I fix it?

@anggit97
Copy link

anggit97 commented Feb 28, 2018

@jd-alexander you did the trick , it working ok!
@useit4me you makes clear explanation, thanks man..

@pranaysharma
Copy link

Sorry Guys my band-aid fix was not working so deleted the post!!

@stephanieporter
Copy link

guys im struggling with this, im following a yoga tutorial and i have no idea what to do :(

@panpan1997
Copy link

panpan1997 commented Mar 23, 2018

@stephanieporter
@jd-alexander
you need to add following code in the build.gradle (Project: Your Project)
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
and add following code in the build.gradle(app)

compile 'com.github.jd-alexander:android-flat-button:v1.1

add change all the buttoncolor to fbuttoncolor

@engmms
Copy link

engmms commented Apr 2, 2018

Hi,All ..I follow the previous steps ,,and still the error

@iSalmankhanZ
Copy link

thanks a lot @jd-alexander your library works like charm.

@jd-alexander
Copy link

@iSalmankhanZ No problem. Really happy this minor fix has helped so many users! 😎

@chrisdavery
Copy link

![Uploading image.png…] i tried @jd-alexander 's tip at my existing app . but it appears like this how could fix i fix it?

@chrisdavery
Copy link

image

@chrisdavery
Copy link

chrisdavery commented Jul 8, 2018 via email

@chrisdavery
Copy link

chrisdavery commented Jul 8, 2018 via email

@vincentieng
Copy link

@iSalmankhanZ
Hello, I know it's not the appropriate topic but as you've done the restauration app. I would like to ask you if you can help me because i'm stuck on a little problem for 3 days.

I'm at the part where when you click on a food, it's suppose to show you the detail and the quantity you would like to purchase, the problem is that when I click on the food. It seems that my clickListener is not working, here is my code.

`private void loadMenu(){
adapter = new FirebaseRecyclerAdapter<Category,MenuViewHolder>(Category.class,R.layout.menu_item, MenuViewHolder.class, category) {
@OverRide
protected void populateViewHolder(final MenuViewHolder viewHolder, Category model, int position) {
viewHolder.txtMenuName.setText(model.getName());
Picasso.with(getBaseContext()).load(model.getImage())
.into(viewHolder.imageView);
final Category clickItem = model;
viewHolder.setItemClickListener(new ItemClickListener() {
@OverRide
public void onClick(View view, int position, boolean isLongClick) {
Toast.makeText(Home.this, ""+clickItem.getName(), Toast.LENGTH_SHORT).show();
Intent foodList = new Intent(Home.this, FoodList.class);
foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
startActivity(foodList);

                }
            });
        }
    };

    recycler_menu.setAdapter(adapter);
}`

I would also know if it is possible to DM on github (i'm a noob x) ) or create an independant topic like on stackoverflow.

Thanks a lot

@iSalmankhanZ
Copy link

iSalmankhanZ commented Jul 16, 2018

@vincentieng here you go, you have to update firebase from 11.0 to 12.0 or higher
refer this https://github.com/iSalmankhanZ/FINALproject

//Loading Menu
private void loadMenu() {
FirebaseRecyclerOptions options = new FirebaseRecyclerOptions.Builder()
.setQuery(category, Category.class)
.build();
adapter = new FirebaseRecyclerAdapter<Category, MenuViewHolder>(options) {
@OverRide
protected void onBindViewHolder(@nonnull MenuViewHolder viewHolder, final int position, @nonnull Category model) {
viewHolder.txtMenuName.setText(model.getName());
Picasso.with(getBaseContext()).load(model.getImage())
.into(viewHolder.imageView);
final Category clickItem = model;
viewHolder.setItemClickListner(new ItemClickListner() {
@OverRide
public void onClick(View v, int adapterPosition, boolean isLongClick) {
Intent serviceList = new Intent(Home.this, FoodList.class);
serviceList.putExtra("CategoryId", adapter.getRef(position).getKey());
startActivity(serviceList);
}
});
}
@nonnull
@OverRide
public MenuViewHolder onCreateViewHolder(@nonnull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.menu_item, parent, false);
return new MenuViewHolder(itemView);
}
};
adapter.startListening();
recycler_menu.setAdapter(adapter);
}

@vincentieng
Copy link

@iSalmankhanZ
Thank you, it works for me.

@iSalmankhanZ
Copy link

@vincentieng Happy to know.

@agottiparthy1
Copy link

I have done all the requires steps, but I am getting errors in the FButton class. Please advice on a fix:

image

@agottiparthy1
Copy link

Update: I replaced the FButton class in the original place to the new .class file. But I am still getting the same error.
image

@iSalmankhanZ
Copy link

@agottiparthy1 please send a image of gradle and color so we can be of help to you.

@nizarmeyzar
Copy link

@iSalmankhanZ hellooooo ..
can u help me to build project AndroidEatit ?
my project can't run on the emulator, my journey is still far from completing this project.
can you help me?
You are very good if you want to send your project to me.
if you don't want to send your project, I hope you can guide me to complete this project.

@syamina
Copy link

syamina commented Sep 16, 2018

What do you mean?

Same as @jd-alexander said. Just rephrasing here. the fix is

  1. Copy the file FButton.java from here -->
    https://github.com/hoang8f/android-flat-button/blob/master/library/src/main/java/info/hoang8f/widget/FButton.java to src/main/java/
  2. In the FButton.java change FButton_buttonColorat the line no
    115 } else if (attr == R.styleable.FButton_buttonColor) to
    } else if (attr == R.styleable.FButton_fButtonColor) {
  3. Copy/Merge the 3 files under the https://github.com/hoang8f/android-flat-button/tree/master/library/src/main/res/values
  4. Make sure the build.gradle (Module) uses the library
    compile 'com.github.jd-alexander:android-flat-button:v1.1'
  5. Make sure build.ggradle (project) has the jipack repository enabled like this
    allprojects { repositories { google() jcenter() maven { url 'https://jitpack.io' } } }
  6. In the activity_main.xml or similar wherever you guys are using the widget info.hoang8f.widget.FButton if you are using the property ButtonColor; change it to fButtonColor

If you have these steps taken care of the build should run fine.

hey , my problem is that my FButton is only in read only mode , how can i change it to writable mode to follow step 2?

@iSalmankhanZ
Copy link

@nizarmeyzar, hello sorry for late replay and my repository is open you can access code when ever you want.

@iSalmankhanZ
Copy link

@nizarmeyzar if you still need help please let me know will help you for sure.

@iSalmankhanZ
Copy link

@syamina hello i am not able to understand your error properly can you please share your error screenshot so we can help.

@iSalmankhanZ
Copy link

iSalmankhanZ commented Nov 17, 2018 via email

@alisakhi
Copy link

alisakhi commented Mar 8, 2019

Hello i am facing following error after changes made

CONFIGURE FAILED in 0s
ERROR: Gradle DSL method not found: 'implementation()'
Possible causes:

The project 'ChabookDelivery' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.3.2 and sync project

The project 'ChabookDelivery' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file

The build file may be missing a Gradle plugin.
Apply Gradle plugin

@Kin-AppDev
Copy link

Kin-AppDev commented Aug 3, 2019

Hi, I have followed all the instrustions above and I know the instructions say copy & merge these three files (attrs.xml, colors.xml, dimens.xml).

Edited: I have fixed the other errors, but I am still having trouble with the attribute part. Specifically I have problems with all the 5 attributes coming up as errors 8 times with this message: "error: failed linking file resources."

__error1 on Fix_Fbutton

@iSalmankhanZ
Copy link

@Kin-AppDev could you please share the logcat information, so that i can help you further.
Thanks.

@Kin-AppDev
Copy link

Kin-AppDev commented Aug 3, 2019

Sure thing @SalmankhanZ, but I'm not sure if those errors from there related to the fButton though, I've see those errors before and other projects seem to be fine with it. But I can't be certain though.
__error2 on logcat
Thanks in advance

@Kin-AppDev
Copy link

Kin-AppDev commented Aug 4, 2019

It seems I have fixed most errors but the errors related to the attrs.xml still remains. How to set that file up and how do I enable that xmls:fbutton statement (it's grayed out atm)? Thanks in advance.
__error3 fixed most

In addition, I have problems with all the 5 attributes coming up as errors 8 times with this message: "error: failed linking file resources." I think is related to the fact that I can't get that xmls statement working. Please help. Thanks.

@Kin-AppDev
Copy link

Kin-AppDev commented Aug 4, 2019 via email

@iSalmankhanZ
Copy link

Hi @Kin-AppDev please email me at [email protected], lets not discuss the things that are not related to @jd-alexander's library. Thanks

@harshchinu
Copy link

Hey
i followed all step right I got an error like
Program type already present: info.hoang8f.widget.FButton
while building the program can you help me

@ZulfiqarRazali
Copy link

Capture

Hello, i want to ask, i already put 'com.github.jd-alexander:android-flat-button:v1' as my library and maven { url "https://jitpack.io" }, maven { url "https://maven.google.com" } as repositories but i still get an error

@sayyedfaisal06
Copy link

@jd-alexander your minSDK version is 17 and it is giving error that it should be atleast 19. how to do it

@jd-alexander
Copy link

@sayyedfaisal06 you would have to fork the project and lessen the minSdk or the easier solution would be to use the manifest merger and force the library's min sdk. Check out this question & answer on Stack Overflow https://stackoverflow.com/questions/27335889/how-do-i-ignore-minsdkversion-of-library-in-android-studio

@sangramsahutech
Copy link

I have followed all the 6 steps to resolve all the errors but at the end it says Duplicate class found as below -
image

Would you please help me to resolve this issue?
Capture

@sangramsahutech
Copy link

Duplicate class info.hoang8f.fbutton.BuildConfig found in modules jetified-android-flat-button-v1.1-runtime.jar (com.github.jd-alexander:android-flat-button:v1.1) and jetified-fbutton-1.0.5-runtime.jar (info.hoang8f:fbutton:1.0.5)

Duplicate class info.hoang8f.widget.FButton found in modules jetified-android-flat-button-v1.1-runtime.jar (com.github.jd-alexander:android-flat-button:v1.1) and jetified-fbutton-1.0.5-runtime.jar (info.hoang8f:fbutton:1.0.5)

@sayyedfaisal06
Copy link

sayyedfaisal06 commented Feb 12, 2021 via email

Repository owner deleted a comment from signedbytes Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests