zhangyanping987 2022-07-13 12:42 采纳率: 100%
浏览 130
已结题

安卓跟着《第一行代码》操作,遇到的问题

就是让一个活动跳转到指定的网页,然后按下按键的时候会询问是打开网页还是打开thirdActivity活动
是想创建一个活动,注册,能让他响应Intent的隐式调用

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);
报错信息
Android resource linking failed
D:\AndroidProject\ActivityTest\app\build\intermediates\packaged_manifests\debug\AndroidManifest.xml:26: error: unexpected element <intent_filter> found in <manifest><application><activity>.

AndroidManifest文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.activitytest">
    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.ActivityTest"
        tools:targetApi="31">
        <activity//这个是注册的活动
            android:name=".ThirdActivity"
            android:exported="false">
            <intent_filter>//注册这个活动后就报错了,跟着书上来的,让这个活动能够响应http
                <action android:name="android.intent.action.VIEW"/>
                <categroy android:name="android.intent.category.DEFAULT"/>
                <data android:scheme="http"/>
            </intent_filter>
        </activity>

        <activity
            android:name=".SecondActivity"
            android:label="This is SecondActivity"
            android:exported="false">
            <intent-filter>
                <action android:name="com.example.activitytest.ACTION_START" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="com.example.activitytest.MY_CATEGORY" />
            </intent-filter>
        </activity>

        <activity
            android:name=".FirstActivity"
            android:exported="true"
            android:label="This is FirstActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

    </application>

</manifest>
  • 写回答

1条回答 默认 最新

  • 不会写代码的猴子 Android领域优质创作者 2022-07-13 15:43
    关注

    img


    要认真啊
    人家是 跟你的一样吗?比对一下

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 7月19日
  • 已采纳回答 7月13日
  • 修改了问题 7月13日
  • 修改了问题 7月13日
  • 展开全部

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效