MainActivity не найден в файле манифеста, но я объявил его - PullRequest
0 голосов
/ 11 октября 2018

Я использую Android Studio 3.2. Я не могу запустить проект Android, показывая ошибку:

MainActivity not found in the Manifest file

, но я также объявляю, и тогда я не могу также создать новый проект.Итак, я собираюсь удалить и переустановить Android Studio и очистить настройки Android Studio.Но это не работает.

Когда я также создаю новый проект, появляется следующая ошибка:

> MyApplication\app\src\main\res\values\colors.xml:1:1: Error: Content is not allowed in prolog.

Когда я запускаю существующий проект, это сообщение показывает:

MainActivity not found in Manifest file

enter image description here

Манифест:

<?xml version="1.0" encoding="utf-8"?>
<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=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Ответы [ 3 ]

0 голосов
/ 11 октября 2018

Пожалуйста, подтвердите в первой строке вашего colors.xml <?xml version="1.0" encoding="utf-8"?>?

Подсказка об ошибке Error: Content is not allowed in prolog показала причину, по которой вы не можете запустить это приложение.

0 голосов
/ 11 октября 2018
<?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.yourpackage.applicationname">

<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=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
</manifest>
0 голосов
/ 11 октября 2018
  <?xml version="1.0" encoding="utf-8"?>

<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=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...