Not able to generate signed apk. Proguard throwing error

By : n9153
Source: Stackoverflow.com
Question!

I am successfully able to generate the debug apk of my Android app. But while generating a signed version I get the message:

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) Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

:app:transformClassesAndResourcesWithProguardForRelease FAILED Error:Execution failed for task

':app:transformClassesAndResourcesWithProguardForRelease'.

java.io.IOException: Please correct the above warnings first.

Following is the list of my project dependencies:

dependencies {
    compile 'ch.acra:acra:4.5.0'
    compile project(':androidHorizontalListView')
    compile 'cz.msebera.android:httpclient:4.4.1.1'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.github.bumptech.glide:glide:3.5.2'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.mikhaellopez:circularimageview:3.0.2'
    compile 'com.android.support:design:24.0.0'
    compile 'com.github.danylovolokh:hashtag-helper:1.1.0'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    compile 'com.android.support:cardview-v7:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
}
By : n9153


Answers

methodscount.com shows, that Acra (v 4.5.0) depends on:

org.json:json:20080701

You have two choices:

  1. Update Acra to version 4.7.0

or

  1. Add this dependency


You can debug your mongo queries in multiple ways.

Start with your index usage using below command :
db.images.aggregate( [ { $indexStats: { } } ] )

If this don't give you any useful information, then check the execution plan of the slow queries using : db.setProfilingLevel(2)
db.system.profile.find().pretty()

db.system.profile will give you complete profile of your queries.



C++11 solution:

#include <type_traits>

template<typename From, typename To>
To map(From e) {
    return static_cast<To>(
        static_cast<typename std::underlying_type<To>::type>(
        static_cast<typename std::underlying_type<From>::type>(e)));
}

This casting cascade is very explicit and supports enum classes.

For older C++ versions and for enums without class, static_cast<Enum2>(e) would suffice.

Edit:

With template specialization, you can use map without specifying any types explicitly:

enum class Enum1: int {A, B, C, D};
enum class Enum2: char {A1, B1, C1, D1};

template<typename T>
struct target_enum {
};

template<>
struct target_enum<Enum1> {
    typedef Enum2 type;
};

template<typename From>
typename target_enum<From>::type map(From e) {
    typedef typename target_enum<From>::type To;
    return static_cast<To>(
        static_cast<typename std::underlying_type<To>::type>(
        static_cast<typename std::underlying_type<From>::type>(e)));
}

You can then call map(Enum1::A). Also works with simple, non-class enums.

By : flyx


This video can help you solving your question :)
By: admin