我正在尝试按照这些步骤为 stetho 编写插件。
它需要在自定义应用程序的 onCreate 方法中进行一些初始化。
public class MyApplication extends Application {
public void onCreate() {
super.onCreate();
Stetho.initializeWithDefaults(this);
}
}
并在 AndroidManifest.xml 中为同一应用程序创建一个条目。
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
...>
<application
android:name="MyApplication"
...>
</application>
</manifest>
但是在尝试flutter run
依赖此插件的颤振应用程序时出现错误-
D:\Dev\Repo\flutter_test\myapp\android\app\src\main\AndroidManifest.xml:16:9-57 Error:
Attribute application@name value=(io.flutter.app.FlutterApplication) from AndroidManifest.xml:16:9-57
is also present at [:stetho] AndroidManifest.xml:7:18-76 value=(com.vilokanlabs.stetho.stetho.MyApplication).
Suggestion: add 'tools:replace="android:name"' to <application> element at AndroidManifest.xml:15:5-38:19 to override.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@name value=(io.flutter.app.FlutterApplication) from AndroidManifest.xml:16:9-57
is also present at [:stetho] AndroidManifest.xml:7:18-76 value=(com.vilokanlabs.stetho.stetho.MyApplication).
Suggestion: add 'tools:replace="android:name"' to <application> element at AndroidManifest.xml:15:5-38:19 to override.