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

Internal Log causes java.lang.NullPointerException when compiled with ProGuard #387

Closed
volser opened this issue Jun 16, 2017 · 3 comments
Closed

Comments

@volser
Copy link

volser commented Jun 16, 2017

Running version 5.0.0-rc2 built on 2017.06.10

with PRO GUARD

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference
at eu.davidea.flexibleadapter.utils.Log.getTag(Unknown Source)
at eu.davidea.flexibleadapter.utils.Log.i(Unknown Source)
at eu.davidea.flexibleadapter.FlexibleAdapter.addListener(Unknown Source)
at co.mangotechnologies.clickup.adapters.a.addListener(Unknown Source)
at eu.davidea.flexibleadapter.FlexibleAdapter.(Unknown Source)

@davideas davideas changed the title Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] Internal Log causes java.lang.NullPointerException when compiled with ProGuard Jun 16, 2017
@davideas davideas added the bug label Jun 16, 2017
@davideas
Copy link
Owner

@volser, thanks for reporting.

Could you please add the following lines in the pro-guard file as the pro-guard manual states?

We're keeping all source file attributes, but we're replacing their values by the string "SourceFile". We could use any string. This string is already present in all class files, so it doesn't take up any extra space.

We're also keeping the line number tables of all methods.

Whenever both of these attributes are present, the Java run-time environment will include line number information when printing out exception stack traces.

-printmapping out.map
-renamesourcefileattribute SourceFile 
-keepattributes SourceFile,LineNumberTable

In the mean time I provide a fix for future releases.

@davideas
Copy link
Owner

davideas commented Jun 16, 2017

However, the default internal log has a SUPPRESS feature, but I forgot to set it as default value for the level, you can also do the following, it should fix as well the problem with pro-guard, because the log will never be executed;

if (BuildConfig.DEBUG) {
    FlexibleAdapter.enableLogs(Level.DEBUG);
} else {
    FlexibleAdapter.enableLogs(Level.SUPPRESS);
}

@volser
Copy link
Author

volser commented Jun 16, 2017

yeah thanks, I already set Log.setLevel
I created issue to fix for future

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

No branches or pull requests

2 participants