Flipper: App failing in release mode Android

Created on 25 Jul 2018  路  4Comments  路  Source: facebook/flipper

When I run my app in release mode I am getting this:

symbol: variable DescriptorMapping
location: class MainApplication
/Users/greenhouse/tmp4IH6GC/app/src/main/java/com/locus/handy/MainApplication.java:57: error: cannot find symbol
if (BuildConfig.DEBUG && SonarUtils.shouldEnableSonar(this)) {
^
symbol: variable SonarUtils
location: class MainApplication
/Users/greenhouse/tmp4IH6GC/app/src/main/java/com/locus/handy/MainApplication.java:58: error: cannot find symbol
final SonarClient client = AndroidSonarClient.getInstance(this);
^
symbol: class SonarClient
location: class MainApplication
/Users/greenhouse/tmp4IH6GC/app/src/main/java/com/locus/handy/MainApplication.java:58: error: cannot find symbol
final SonarClient client = AndroidSonarClient.getInstance(this);
^
symbol: variable AndroidSonarClient
location: class MainApplication
/Users/greenhouse/tmp4IH6GC/app/src/main/java/com/locus/handy/MainApplication.java:60: error: cannot find symbol
client.addPlugin(new InspectorSonarPlugin(getApplicationContext(), descriptorMapping));
^
symbol: class InspectorSonarPlugin
location: class MainApplication
/Users/greenhouse/tmp4IH6GC/app/src/main/java/com/locus/handy/MainApplication.java:61: error: cannot find symbol
client.addPlugin(new SharedPreferencesSonarPlugin(context,
^

Most helpful comment

@carlosmuvi Here is a Q&D temporary solution I came up with, would be better if this was implemented within the core library tho :/
https://github.com/theGlenn/flipper-android-no-op

All 4 comments

Can you please provide a full example of how your project is set up? Preferably a GitHub project we can check out, or otherwise a full list of the build settings.
If you have those information, please feel free to open a new issue.

I suspect that this is because you're using debugImplementation while importing the lib and so the classes are not found while compiling the release version. If you were to use implementation instead, this will probably compile, but it will bloat your release app. Another solution would be to have a separate Application class for the debug version of your project that includes Sonar while the main Application class excludes it.

@passy do you know if there are plans to include empty class definitions of the lib for a releaseImplementation?

A no-op version (similar to LeakCanary) for release implementations would be really useful to avoid duplicating the application class by buildType, are at the end any plans on adding it? Thanks!

@carlosmuvi Here is a Q&D temporary solution I came up with, would be better if this was implemented within the core library tho :/
https://github.com/theGlenn/flipper-android-no-op

Was this page helpful?
0 / 5 - 0 ratings