Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

bug: Whenever I run an Android emulator, AndroidManifest.xml get changed

未关闭
#4,898 0 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
android, typescript
领域
cli, mobile-dev

调研方向

首先,使用列出的 Capacitor 项目设置,通过 ionic cap run android -l --external --target Pixel_5_API_33 重现该问题。检查 AndroidManifest.xml 何时发生更改以及何时创建 AndroidManifest.xml.org,然后验证模拟器启动后不再更改格式,也不会留下备份文件。

由索引模型根据 Issue 内容生成。

描述

triage

Description:

I am using Ionic 6 with React. I run the following command to start up Android emulator:

ionic cap run android -l --external --target Pixel_5_API_33

The emulator starts up, but right away the AndroidManifest.xml file get updated and an AndroidManifest.xml.org file is added.

When I shut the emulator down, everything goes back to normal. In other words, the changes to the AndroidManifest.xml are reverted and the AndroidManifest.xml.org is deleted.

I’ve not seen any equivalent behavior with iOS.

Steps to Reproduce:

You can reproduce this by creating a new project ionic start photo-gallery tabs --type=react --capacitor

Then add android to the project ionic cap add android

Then start up an emulator: ionic cap run android -l --external --target Pixel_5_API_33

Output:

My ionic info:

Ionic:

   Ionic CLI : 6.20.1 (/Users/nathan/.local/share/yarn/global/node_modules/@ionic/cli)

Capacitor:

   Capacitor CLI      : 4.0.1
   @capacitor/android : 4.0.1
   @capacitor/core    : 4.0.1
   @capacitor/ios     : 4.0.1

Utility:

   cordova-res : not installed globally
   native-run  : not installed globally

System:

   NodeJS : v16.15.1 (/Users/nathan/.asdf/installs/nodejs/16.15.1/bin/node)
   npm    : 8.11.0
   OS     : macOS Monterey

Other Information:

The settings (i.e. data) in the file does not change. Only the formatting. It changes from:

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

    <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:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:name="dev.todos.mobile.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask"
            android:screenOrientation="fullSensor"
            android:exported="true">

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

        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>

    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
</manifest>

To:

<?xml version='1.0' encoding='utf-8'?>
<manifest package="dev.todos.mobile" xmlns:android="http://schemas.android.com/apk/res/android">
    <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" android:usesCleartextTraffic="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:exported="true" android:label="@string/title_activity_main" android:launchMode="singleTask" android:name="dev.todos.mobile.MainActivity" android:screenOrientation="fullSensor" android:theme="@style/AppTheme.NoActionBarLaunch">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
        </provider>
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>
主要语言
TypeScript
星标
2k
派生
681
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ionic-team/ionic-cli 的其他 Issue

查看 ionic-team/ionic-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。