Flutter应用上传Google Play遇android:exported属性缺失报错求助
上传Google Play时「存在intent filter但未设置android:exported属性」错误解决
上传Flutter应用至Google Play商店时触发「存在intent filter但未设置android:exported属性」错误,已尝试升级Flutter至最新版本、更新所有依赖包,问题仍未解决。以下是我的配置文件:
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.zroom" xmlns:tools="http://schemas.android.com/tools"> <queries> <!-- If your app opens https URLs --> <intent> <action android:name="android.intent.action.VIEW" /> <data android:scheme="https" /> </intent> <!-- If your app makes calls --> <intent> <action android:name="android.intent.action.DIAL" /> <data android:scheme="tel" /> </intent> <!-- If your sends SMS messages --> <intent> <action android:name="android.intent.action.SENDTO" /> <data android:scheme="smsto" /> </intent> <!-- If your app sends emails --> <intent> <action android:name="android.intent.action.SEND" /> <data android:mimeType="*/*" /> </intent> </queries> <!-- For Ios --> <!--<key>LSApplicationQueriesSchemes</key> <array> <string>https</string> <string>http</string> </array>--> <uses-permission android:name="android.permission.INTERNET"/> <!-- Add this --> <application tools:replace="android:label" android:label="Zroom" android:exported="true" android:name="${applicationName}" android:icon="@mipmap/ic_launcher"> <activity android:name=".MainActivity" android:exported="true" > <!-- Specifies an Android theme to apply to this Activity as soon as the Android process has started. This theme is visible to the user while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> <meta-data android:exported="true" android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" /> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Accepts URIs that begin with https://YOUR_HOST --> <data android:scheme="https" android:host="meet.zroom.com" /> </intent-filter> </activity> <!-- Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> </application> </manifest>
pubspec.yaml
dependencies: flutter: sdk: flutter intl: ^0.17.0 jitsi_meet: ^4.0.0 shared_preferences: ^2.0.15 uni_links: ^0.5.1 flutter_inset_box_shadow: ^1.0.7 url_launcher: http: ^0.13.4 universal_html: ^2.0.0 html: ^0.15.0 animations: ^2.0.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter flutter_launcher_icons: ^0.10.0 flutter_native_splash: ^2.0.1+1 flutter_native_splash: color: "#ffffff" image: assets/images/logosmall.png flutter_icons: android: true ios: true image_path: "assets/images/logosmallx.png"
可行解决方案
- 检查合并后的Manifest文件:查看项目
build/intermediates/merged_manifests/[build类型]/AndroidManifest.xml(比如debug或release),找到所有带有<intent-filter>但未设置android:exported的组件(Activity、Service、BroadcastReceiver),这些通常是第三方依赖库引入的。 - 手动覆盖依赖组件的exported属性:在自己的AndroidManifest.xml中,针对上述找到的组件,添加声明并设置
android:exported(根据组件用途设true或false),同时用tools:replace="android:exported"确保覆盖依赖库的配置。比如针对jitsi_meet可能存在的组件:<activity android:name="org.jitsi.meet.sdk.JitsiMeetActivity" android:exported="false" tools:replace="android:exported" /> - 清理构建缓存后重新构建:执行以下命令清理缓存并重新获取依赖:
之后重新生成APK或AAB文件。flutter clean flutter pub get - 排查依赖库版本:部分旧版依赖库未适配Android 12+的
exported要求,尝试将问题依赖(比如jitsi_meet)升级至最新稳定版,若没有新版则考虑替换为替代库。
内容的提问来源于stack exchange,提问作者MD ZDN
相关产品推荐
相关产品推荐

