6

I am currently trying to generate a release build for an app in Android Studio. I have attempted to get rid of all issues while generating the release build but I am stuck on a few issues.

Warning:com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning:org.androidannotations.api.rest.RestClientHeaders: can't find referenced class org.springframework.http.HttpAuthentication
Warning:org.androidannotations.api.rest.RestClientSupport: can't find referenced class org.springframework.web.client.RestTemplate
Warning:org.androidannotations.api.rest.RestErrorHandler: can't find referenced class org.springframework.core.NestedRuntimeException
Warning:there were 4 unresolved references to classes or interfaces.
     You may need to add missing library jars or update their versions.
     If your code works fine without the missing classes, you can suppress
     the warnings with '-dontwarn' options.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 1 unresolved references to library class members.
     You probably need to update the library versions.
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task 
java.io.IOException: Please correct the above warnings first.

I am also presented with an error which states

Error:Execution failed for task ':app:packageRelease'.
> Unable to compute hash of  /Users/rohanmahale/AndroidStudioProjects/Prism/app/build/intermediates/classes-proguard/release/classes.jar

In my gradle file I have set the following

android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
    applicationId 'com.prism.prismapp'
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}

}

My list of dependencies are as follows

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.commonsware.cwac:camera:0.6.+'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'commons-io:commons-io:2.4'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.github.nkzawa:socket.io-client:0.5.2'
compile 'io.nlopez.smartlocation:library:3.2.0'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
    transitive = true;
}
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.pixplicity.multiviewpager:library:1.0'
compile 'com.githang:viewpagerindicator:2.4.2@aar'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
compile 'com.commit451:PhotoView:1.2.4'
compile 'me.villani.lorenzo.android:android-cropimage:1.1.0'
compile ('com.google.android.gms:play-services-analytics:8.1.0') {
    exclude module: 'play-services-ads'
}}

How do I get rid off the issues and successfully create the release build??

UPDATE :

I was able to get rid of the warning related to android annotations.

I am left with the following issue

Warning:com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning:there were 1 unresolved references to library class members.
     You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Rohan
  • 593
  • 7
  • 22
  • 1
    It might be because `FloatMath.ceil()` is decrepeated. You have to change with `Math.ceil()`. – Blo Nov 06 '15 at 15:09
  • How and where should I make this change? It is part of a viewindicator library aar that I found. – Rohan Nov 06 '15 at 15:24
  • Indeed, this will be a problem. I got this same issue but I used the lib in local folder, therefore I was able to change these methods. There are `private` in LinePageIndicator.java, so I don't know at least you get this lib in local folder. – Blo Nov 06 '15 at 15:37
  • Any ideas on how I should go about this? I need to create a release ASAP and send it to a client. – Rohan Nov 06 '15 at 15:41
  • If you can't wait: download [the lib ViewPagerIndicator](https://github.com/msdx/ViewPagerIndicator) zip, unzip into libs folder, change the two decrepeated methods and follow [this answer to add external libs](http://stackoverflow.com/a/16639227/2668136) into your project gradle. HTH – Blo Nov 06 '15 at 15:51
  • Hey @Fllo. This is exactly what I ended up doing. If you add this as an answer, I will upvote it as a solution which helped me. Downloaded the project , added it as a dependency and then changed the FloatMatch to Math. Thanks again! – Rohan Nov 06 '15 at 21:08

2 Answers2

10

For me the current solution is to add the following line to my proguard file:

-dontwarn com.viewpagerindicator.**

This will remove warning coming in above package when you create release build

Kushal
  • 8,100
  • 9
  • 63
  • 82
MUHAMMAD SOBAN
  • 403
  • 8
  • 20
0

Use this, it has the fix.

compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'

You can check out this github issue

Silvia H
  • 8,097
  • 7
  • 30
  • 33