diogobernardino / williamchart

Android Library to rapidly develop attractive and insightful charts in android applications.
5.1k stars 800 forks source link

Proguard breaks library functionality #201

Closed eduardbosch closed 7 years ago

eduardbosch commented 7 years ago

Hi again :)

The problem

I'm using the library with minifyEnabled true in my application. With the released version 0.2.4 there is no problem, but I'm having a lot of problems with the dev version. I need to use the dev version because I need some of the introduced changes.

The cause

In my case, there is two commits that causes my app to not show or not show correctly a BarChartView. Those commits are 80b6204ecaff74d93ac9026788872519fc0648f8 and 4c67e1ef7f49f1e6ec532d8df3a762e93a7be3fa.

80b6204ecaff74d93ac9026788872519fc0648f8 : This causes the BarChartView not to shown when minifyEnabled is activated. Reverting this commit, I can see the chart. 4c67e1ef7f49f1e6ec532d8df3a762e93a7be3fa : This causes the BarChartView to display correctly only the first time. If I enter an activity that has a BarChartView, then I go back and enter again the activity with the BarChartView, the bars are not displayed anymore until I close the app and open it again. In this case, I "solved" this by updating a line in ChartView. This change looks that avoids the proguard to break the library.

    float getBorderSpacing() {

        Log.v(TAG, "" + style.axisBorderSpacing);
        return style.axisBorderSpacing;
    }

I haven't used ProGuard a lot, so I don't know if I can add some rules to avoid the library break.

The problem is that I have only seen this problem in one device: Motorola Moto G4 Android 6.0.1

Some tests

I've tested also the Williamchart mobile demo with minify enabled. It's working correctly in all the decives I've checked except the Moto G4. Here there is some screenrecords. The version installed in each device is the same. The icon is different because I had the old version installed:

OnePlus 2 williamchart_oneplus2

Moto G4 williamchart_moto-g4

Do you know how ProGuard works or how I could check what is introducing this? It's really strange that proguard only breaks the charts in Moto G4 😞

Thanks a lot!

Edu

eduardbosch commented 7 years ago

Hi,

I've updated the Moto G4 to Android 7 and now it's working like expected. I't might by a problem only in Moto G4 Android 6 and they might have fixed it in Android 7.

If you think this is something that should not bother you, simply close the issue.

I hope that Moto G4 is the only device that has problems with minified code.

Thanks again 😃

Edu

eduardbosch commented 7 years ago

Hi @diogobernardino,

I've found another device that didn't display the bar charts. I don't know the device model and Android version sorry.

Just to let you know. Do you think that something could have broken the chart display on some devices due to the commits I've reported in the first comment?

I don't reopen the issue. Just wanted to add this note.

If I have more information, I'll let you know. Sorry for bothering you with not detailed information.

Thanks