我需要在Flutter项目中具有一些本地Android代码和配置,例如在AndroidManifest.xml文件中。但是我添加的标签的属性未知(红色)并且不起作用,特别是我在这里使用的<receiver>
和<intent-filter>
标签。
我还需要处理Flutter库中的一些本地Java文件,我也不知道该怎么办!
以下是我在IDE中的清单映像及其代码:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.flutterapp">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<!-- 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="my app"
android:allowBackup="false"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Black.NoTitleBar"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name = ".SmsReceiver" android:permission="android.permission.BROADCAST_SMS">
<intent-filter android:priority="999" >
<action android:name="android.intent.action.SMS_RECEIVED" />
<action android:name="android.provider.Telephony.SMS_DELIVER" />
<data
android:scheme="sms"
android:host="*"
android:port="1235" />
</intent-filter>
</receiver>
</application>
</manifest>
答案 0 :(得分:0)
在您的代码中,有两个应用程序标记将其删除。并将名称标签添加到现有的应用程序标签中
在清单文件中,您只能使用一个应用程序标签
因此,请用此代码替换您的代码。有关更多信息,Refer
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="saleskit.orbitsys.com.androidvolleysingletondemo">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name=".AppController"
android:theme="@style/AppTheme"
>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>