Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Not working with api 23. FloatMath is deprecated. use Math instead. #366

Open
maxandron opened this issue Aug 22, 2015 · 49 comments
Open

Not working with api 23. FloatMath is deprecated. use Math instead. #366

maxandron opened this issue Aug 22, 2015 · 49 comments

Comments

@maxandron
Copy link

com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath

@beraldofilippo
Copy link

Same here! I hope for a quick fix. In the meantime, is there any workaround?

@dvdh
Copy link

dvdh commented Aug 24, 2015

If you look at the source for FloatMath, it is just doing this:
public static float ceil(float value) {
return (float) Math.ceil(value);
}
very straightforward to fix.

@mturki
Copy link

mturki commented Aug 25, 2015

Same here...

@HE-LU
Copy link

HE-LU commented Aug 27, 2015

bump

@zfoltin
Copy link

zfoltin commented Aug 27, 2015

+1

@maxandron
Copy link
Author

For me the current solution is to add the following line to my proguard file:
-dontwarn com.viewpagerindicator.**

@tomafc330
Copy link

If you are not using the Line style indicator then @maxandron's answer works

@yudhir
Copy link

yudhir commented Sep 1, 2015

I am getting the same error for API 23 . All functions were removed!

@ImranAtBhimsoft
Copy link

Same here.

@ggrell
Copy link

ggrell commented Sep 15, 2015

Fixed in this PR: #370 just needs a merge & release

@shiami
Copy link

shiami commented Sep 23, 2015

+1

1 similar comment
@Shahroz16
Copy link

+1

@trinadhkoya
Copy link

You can make use of this (float)Math.sqrt(...)

@d34n0s
Copy link

d34n0s commented Oct 21, 2015

+1

@expilu
Copy link

expilu commented Nov 9, 2015

+1

@black-snow
Copy link

looking forward to a fix/ merge of the fix + release

@AntonioCappiello
Copy link

+1

@trinadhkoya
Copy link

I already mentioned make use of (float)Math.sqrt(...).it will work for you sure.I did it and worked well for me

@AntonioCappiello
Copy link

@trinadhkoya I actually don't need to use that function, but proguard complains about that when I build the release version and I don't know if the library itself use that function somewhere and may cause some run-time exception

@trinadhkoya
Copy link

trinadhkoya commented Nov 18, 2015 via email

@calvarez-ov
Copy link

+1

@lorenzopolidori
Copy link

A more targeted workaround is to add to proguard:
-dontwarn com.viewpagerindicator.LinePageIndicator.

@vincent-paing
Copy link

+1

@AntonioCappiello
Copy link

Thanks @lorenzopolidori, your suggestion may temporarily hide the problem from the build server log but it doesn't actually solved it as suggested here.

Nobody wants that in "a shiny day close to the release the app breaks because of some deprecated method which disappears from the lib" :-)

@lorenzopolidori
Copy link

@AntonioCappiello Yes, I agree. The workaround I suggested is just to make a build successful until one of the proposed PR's is accepted and merged into the project (which should happen asap I think).

@avafab
Copy link

avafab commented Dec 3, 2015

+1

2 similar comments
@jczerski
Copy link

jczerski commented Dec 9, 2015

+1

@adrien-aubel
Copy link

+1

@ubeyou
Copy link

ubeyou commented Dec 14, 2015

+1

1 similar comment
@marcinbak
Copy link

+1

@MostafaSh
Copy link

Hey guys!
just do what i say to solve the problem.
replace
return (int)floatMath.ceil(result);
with this line:
return (int)((float)Math.ceil(result));

I have tried this solution. It works correctly.

@AntonioCappiello
Copy link

Hi Mostafa, it is what I did in the PR connected to this issue (#385) but it was not merged yet. Probably you haven't read the other comments above. I don't use that function, but the library does. So the warning is not in my code, but in the library. I don't have anything to replace in my code.

@MostafaSh
Copy link

Hi Antonio.
I know. The error is from the library. I had that error to. You have to modify the library.
I'm using android studio. In android studio you can modify any library simply.
If you are using eclipse, just try this :
Extract the jar file out of eclipse, modify the android.util.FloatMath class as I said, add it to archive again as a jar file and import it to your project.
If you had more questions, you can ask me.

And as a friendly offer, just give up working with eclipse and start working with android studio. you will love it.

@MostafaSh
Copy link

Ignore my pervious answer.I thought it has a jar file. I will make a video to show you how you can solve the problem and I will put the video link here .

@AntonioCappiello
Copy link

ahah did I ever mentioned that I use Eclipse?

@MostafaSh
Copy link

Watch this video.
https://m.youtube.com/watch?feature=youtu.be&v=I1fGFL2rqaY
If this video wasn't enough, just tell me to make a better one.

@AntonioCappiello
Copy link

@MostafaSh Why do you include libraries in your project in such "old-fashion" way instead of using a "compile" in gradle pointing to maven/jcenter repo? If the library get updated (bug fixes, improvements, deletion of deprecated methods) then you don't get any of those updates in your way.
Thanks for making the video anyway.
I think that the best solution so far is still to merge the PR mentioned before.

@MostafaSh
Copy link

Actually I'm new in android studio. Thank you for this information about using maven. I don't know anything about that.
But in this situation, for using this library, I succeed with that "old fashion" way!
anyway,

@MostafaSh
Copy link

I'm looking for more information about using maven.that would be kind of you if you get me more information.

@jrejaud
Copy link

jrejaud commented Dec 28, 2015

Hi everyone, I made a fork of ViewPagerIndicator which is compiled via Gradle (thus you can use JitPack) and uses Math instead of FloatMath, so it works with API 23.

It solved my problem, let me know if it works for you too :)

https://github.com/jrejaud/ViewPagerIndicator2

@danikula
Copy link

I published here my solution. It is original Jake's repo with one more additional commit with this fix.

Usage:

repositories {
    maven { url 'https://dl.bintray.com/alexeydanilov/maven' }
}
dependencies {
    compile 'com.viewpagerindicator:viewpagerindicator:2.4.3'
}

avianey added a commit to avianey/Android-ViewPagerIndicator that referenced this issue Feb 15, 2016
@luongbeta2
Copy link

+1

1 similar comment
@yakubbaev
Copy link

+1

@danikula
Copy link

@yakubbaev , @luongbeta2 This repo is not longer supported. There is no chance Jake will fix it and publish. I recommend to use my solution.

@luongbeta2
Copy link

thanks

@dayong38
Copy link

👍

@jrejaud
Copy link

jrejaud commented Mar 31, 2016

And if you're a gradle user instead of maven, then I recommend my solution: https://github.com/jrejaud/ViewPagerIndicator2

@anibalc9
Copy link

+1

@AbdulRehmanNazar
Copy link

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests