Flipper: Not able to generate the release build

Created on 8 Nov 2019  路  5Comments  路  Source: facebook/flipper

I am not able to generate the release build with all debug configuration in place. I am getting following error when I try to generate the signed apk.

Unresolved reference: utils | 聽
-- | --
Unresolved reference: plugins | 聽
Unresolved reference: plugins | 聽
Unresolved reference: plugins | 聽
Unresolved reference: plugins | 聽
Unresolved reference: plugins | 聽
Unresolved reference: plugins | 聽
Unresolved reference: plugins | 聽
Unresolved reference: soloader | 聽
Unresolved reference: SoLoader | 聽
Unresolved reference: FlipperUtils | 聽
Unresolved reference: InspectorFlipperPlugin | 聽
Unresolved reference: DescriptorMapping | 聽
Unresolved reference: NetworkFlipperPlugin | 聽
Unresolved reference: DatabasesFlipperPlugin | 聽
Unresolved reference: SharedPreferencesFlipperPlugin | 聽
Unresolved reference: LeakCanaryFlipperPlugin | 聽
Unresolved reference: CrashReporterPlugin | 聽

My init configuration in application class is

 SoLoader.init(this, false)
        if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) {
            val client = AndroidFlipperClient.getInstance(this)
            client.addPlugin(InspectorFlipperPlugin(this, DescriptorMapping.withDefaults()))
            val networkFlipperPlugin = NetworkFlipperPlugin()
            client.addPlugin(networkFlipperPlugin)
            client.addPlugin(DatabasesFlipperPlugin(this))
            client.addPlugin(SharedPreferencesFlipperPlugin(this, PREF_FILE_NAME))
            client.addPlugin(LeakCanaryFlipperPlugin())
            client.addPlugin(CrashReporterPlugin.getInstance())
            client.start()
        }

Note: All the dependencies are debug implementation as mentioned in the getting started flipper guide.. https://fbflipper.com/docs/getting-started.html

Most helpful comment

This is expected. If you rely on release and debug flavours, you must ensure to only access those symbols from the corresponding build variant. I.e. if you want to access a particular plugin like InspectorFlipperPlugin, this can only happen from src/debug/java/... and not src/main/java/... or src/release/java/....

@passy I've been trying to find a good article for this but i'm not able to find one. Is there a way to setup src/debug/java and src/main/java? I am stuck on this for the last 2 days. Also is a noop version available for NetworkFlipperPlugin

All 5 comments

Hi, I think we'll need a bit more context to help with that. Do you get line numbers where these things are being referenced?

With setup configuration we have in docs

dependencies {
  debugImplementation 'com.facebook.flipper:flipper:0.27.0'
  debugImplementation 'com.facebook.soloader:soloader:0.5.1'

  releaseImplementation 'com.facebook.flipper:flipper-noop:0.27.0'
}

following references will be unresolved when compiling release build:

@Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, false);
    ^

    if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) {
                             ^
      final FlipperClient client = AndroidFlipperClient.getInstance(this);
      client.addPlugin(new InspectorFlipperPlugin(this, DescriptorMapping.withDefaults()));
                           ^                            ^
      client.start();
    }
  }

Obviously, this is because no-op dependency only mocks AndroidFlipperClient, FlipperClient and FlipperPlugin.

Exact same problem with docs only configuration...

This is expected. If you rely on release and debug flavours, you must ensure to only access those symbols from the corresponding build variant. I.e. if you want to access a particular plugin like InspectorFlipperPlugin, this can only happen from src/debug/java/... and not src/main/java/... or src/release/java/....

This is expected. If you rely on release and debug flavours, you must ensure to only access those symbols from the corresponding build variant. I.e. if you want to access a particular plugin like InspectorFlipperPlugin, this can only happen from src/debug/java/... and not src/main/java/... or src/release/java/....

@passy I've been trying to find a good article for this but i'm not able to find one. Is there a way to setup src/debug/java and src/main/java? I am stuck on this for the last 2 days. Also is a noop version available for NetworkFlipperPlugin

Was this page helpful?
0 / 5 - 0 ratings