Open twboc opened 3 months ago
Hey @twboc ,
This worked for me
AndroidManifest.xml
<activity android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity" android:exported="true"/>
MainApplication.kt import update
import com.facebook.flipper.android.AndroidFlipperClient import com.facebook.flipper.android.utils.FlipperUtils import com.facebook.flipper.core.FlipperClient import com.facebook.flipper.plugins.inspector.DescriptorMapping import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.react.modules.network.NetworkingModule import okhttp3.OkHttpClient.Builder
Update to MainApplication.kt onCreate method
override fun onCreate() { super.onCreate() SoLoader.init(this, false) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { load() } if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) {
val client = AndroidFlipperClient.getInstance(this)
client.addPlugin(InspectorFlipperPlugin(this, DescriptorMapping.withDefaults()))
// client.addPlugin(networkFlipperPlugin) val networkFlipperPlugin: NetworkFlipperPlugin = NetworkFlipperPlugin() NetworkingModule.setCustomClientBuilder( object : NetworkingModule.CustomClientBuilder { override fun apply(builder: Builder) { builder.addNetworkInterceptor(FlipperOkhttpInterceptor(networkFlipperPlugin)) } }) client.addPlugin(networkFlipperPlugin) client.start() } }
Hope this helps
I recently implemented flipper for ios react-native app debugging. So far I can see my network requests coming from a iPhone simulator.
Unfortunately I have not been so successful with android kotlin version. I managed to connect flipper and get logs and crashes through adb but the network plugin is not working.
It is added as part of dependencies and I initialise so the app compiles. Unfortunately I cannot see any requests. Tried different solutions but with no luck.
The error I am getting is similar to the one reported here -> Flipper requests not showing - flipper issues
This is also complicated with the fact that I am using OkHttp.
Although I have put everything in place (in my opinion) and the code complies the requests are not showing.
QUESTION: Is it possible for anyone to create a react-native example using kotlin like the one in here. Android Java Example react-native app
I asume this would be beneficial for other developers in the future.