正确编辑android清单
我正在尝试在我的项目中使用flatter_前台_插件,但我很难理解如何编辑android清单文件 这些是必需的编辑: 以下是我对上述编辑的解释: 我做错了什么?我得到了错误正确编辑android清单,android,flutter,dart,Android,Flutter,Dart,我正在尝试在我的项目中使用flatter_前台_插件,但我很难理解如何编辑android清单文件 这些是必需的编辑: 以下是我对上述编辑的解释: 我做错了什么?我得到了错误 error: FlutterForegroundPlugin() has private access in FlutterForegroundPlugin flutterEngine.getPlugins().add(new changjoopark.com.flutter_foreground_plugin.
error: FlutterForegroundPlugin() has private access in FlutterForegroundPlugin
flutterEngine.getPlugins().add(new changjoopark.com.flutter_foreground_plugin.FlutterForegroundPlugin());
此可帮助您配置项目
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="changjoopark.com.flutter_foreground_plugin_example"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Flutter ForegroundService Example"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService"/>
</application>
<uses-sdk
android:minSdkVersion="23"
tools:overrideLibrary="changjoopark.com.flutter_foreground_plugin" />
</manifest>
试着在你的机器上运行它,这样你就可以消除你的疑虑
谢谢。打开foregroundplugin.java
从private flatterforegroundplugin(){}
更改为public flatterforegroundplugin(){}
谢谢!我做了必要的更改,还将包的版本从0.8.0减少到了0.6.0