2

我知道有很多类似的问题,但没有一个能解决我的问题。

首先有一个错误:Cannot resolve symbol 'R'. 同样在构建选项卡中,有一个错误:Build: build failed. 在那一边,它说Manifest merger failed with multiple errors, see logs

我的计划有两个活动。

我已经尝试了人们说要尝试的所有不同方法,但都没有奏效。

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="dennisranish.wificontroller">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".Controller"
            android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".Settings"
            android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
            android:screenOrientation="landscape">
            <intent-filter>
            </intent-filter>
        </activity>

    </application>

</manifest>

在合并清单选项卡中:

Merging Errors: 
Error: Missing one of the key attributes 'action#name,category#name,data#scheme,data#host,data#mimeType,data#port,data#path,data#pathPattern,data#pathPrefix' on element intent-filter at AndroidManifest.xml:25:13-26:29 app main manifest (this file), line 24 
Error: Validation failed, exiting app main manifest (this file)

更新:

您的设置活动声明应如下所示:

<activity android:name=".Settings"
    android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
    android:screenOrientation="landscape" />

这确实修复了AndroidManifest.xml错误。但是Cannot resolve symbol 'R'仍然存在问题,并且在构建选项卡中,仍然存在错误:Build: build failed. 除了现在到那一边,它现在说AAPT2 error: check logs for details

还有一些人说要发布错误日志,我想知道:当我单击时Help > Show Log in Explorer,它是正确的日志吗?因为有 12 个日志都包含超过 1000 行

感谢您的帮助,如果需要任何其他文件,请告诉我。

4

1 回答 1

3

你的错误信息很清楚:

在 AndroidManifest 的元素意图过滤器上缺少关键属性 'action#name,category#name,data#scheme,data#host,data#mimeType,data#port,data#path,data#pathPattern,data#pathPrefix' 之一.xml

您的设置活动有空白intent-filter,删除它将解决问题。

如果intent-filter添加,则必须包含action标签并且可以/不能包含categorydata标签,参考Android intent-filter doc

您的设置活动声明应如下所示:

    <activity android:name=".Settings"
        android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
        android:screenOrientation="landscape" />

希望能帮助到你!

于 2018-08-29T08:44:42.727 回答