Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插件冲突 #136

Open
DaYang816 opened this issue Dec 23, 2023 · 10 comments
Open

插件冲突 #136

DaYang816 opened this issue Dec 23, 2023 · 10 comments

Comments

@DaYang816
Copy link

您好,我在接入广告插件的时候发现冲突,请问有什么建议么。

E:\flutterDemo\ces\android\app\src\debug\AndroidManifest.xml:26:9-60 Error:
	Attribute application@networkSecurityConfig value=(@xml/network_config) from [:flutter_gromore_ads] AndroidManifest.xml:26:9-60
	is also present at [:image_pickers] AndroidManifest.xml:34:9-53 value=(@xml/net_sec).
	Suggestion: add 'tools:replace="android:networkSecurityConfig"' to <application> element at AndroidManifest.xml:14:5-48:19 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Attribute application@networkSecurityConfig value=(@xml/network_config) from [:flutter_gromore_ads] AndroidManifest.xml:26:9-60
  	is also present at [:image_pickers] AndroidManifest.xml:34:9-53 value=(@xml/net_sec).
  	Suggestion: add 'tools:replace="android:networkSecurityConfig"' to <application> element at AndroidManifest.xml:14:5-48:19 to override.
@lisen87
Copy link
Owner

lisen87 commented Dec 23, 2023 via email

@DaYang816
Copy link
Author

这个提示我加过了,直接构建失败了

    <application
        android:label="测试"
        android:name="${applicationName}"
        tools:replace="android:theme"
        android:theme="@style/AppTheme"
        android:icon="@mipmap/ic_launcher"
        tools:replace="android:networkSecurityConfig">

日志

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: Error parsing E:\flutterDemo\ai_miao_ying\android\app\src\main\AndroidManifest.xml

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
Exception: Gradle task assembleDebug failed with exit code 1

@lisen87
Copy link
Owner

lisen87 commented Dec 23, 2023 via email

@lisen87
Copy link
Owner

lisen87 commented Dec 23, 2023

image

@DaYang816
Copy link
Author

DaYang816 commented Dec 23, 2023

感谢您的回复,它报了新的错误

E:\flutterDemo\ces\android\app\src\main\AndroidManifest.xml:14:5-48:19 Error:
	tools:replace specified at line:14 for attribute android:networkSecurityConfig, but no new value specified
E:\flutterDemo\ces\android\app\src\main\AndroidManifest.xml Error:
	Validation failed, exiting

@DaYang816
Copy link
Author

这是我的完整配置

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
    <!-- 网络 -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 检查wifi网络状态 -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 开关Wi-Fi状态,解决中国内地机型移动网络权限问题需要 -->
    <!--网络状态-->
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
    <!-- 储存 -->
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <application
        android:label="测试"
        android:name="${applicationName}"
        tools:replace="android:theme,android:networkSecurityConfig"
        android:theme="@style/AppTheme"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:screenOrientation="portrait">
            <!-- 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: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>
        </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>

@DaYang816
Copy link
Author

您好,我看到一个关闭的issue #98
我自己fork插件然后去删除这行,这个相关操作会影响到插件的运行么

@lisen87
Copy link
Owner

lisen87 commented Dec 23, 2023

这个是不会影响的,可以先这么解决的

@lisen87
Copy link
Owner

lisen87 commented Dec 23, 2023

如果不想 fork的话,可以尝试 在自己项目中 添加 networkSecurityConfig配置,然后通过tools:replace去替换,这样应该是可以的

@DaYang816
Copy link
Author

感谢您的回复,我自己参考2个插件的配置设置了一下可以运行了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants