質問

How can I automatically remove all uses of TestFlight SDK from my app? For example, all passCheckpoint calls:

TestFlight.passCheckpoint("FreemiumDialog opened");

My (ProGuard-obfuscated) release builds should not even attempt to send any info to TestFlight, yet I do not want to manually toggle between having TestFlight jar & its uses in my codebase.

役に立ちましたか?

解決

This ProGuard configuration removes all calls to TestFlight SDK:

# Remove all TestFlight SDK calls, e.g. TestFlight.takeOff( ... );
# and TestFlight.passCheckpoint( ... );
-assumenosideeffects class com.testflightapp.lib.TestFlight { *; }

-dontwarn org.msgpack.**

Note: without the last line, ProGuard fails with a bunch of warnings like:

Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtClass
Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class > org.json.simple.parser.JSONParser

This is because the TestFlightLib jar (at least version 1.3) contains and uses a library called MessagePack. We need to either -keep it or mute the warnings. Above I'm muting warnings, since the whole point here is not to use TestFlight in release builds.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top