【问题标题】:Intent activity class not working意图活动类不起作用
【发布时间】:2016-03-06 19:44:48
【问题描述】:

大家好,我在 android studio 上尝试运行我的应用程序模拟器时遇到了问题。这是我得到的错误:

Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.dre.appli/com.example.dre.appli_app.LoginActivity }
Error type 3
Error: Activity class {com.example.dre.appli/com.example.dre.appli_app.LoginActivity} does not exist.

我尝试了人们建议的所有方法,但均无济于事。这是我的清单

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

    <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

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



        <activity
            android:name=".LoginActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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


        <activity
            android:name=".CreateAccount"
            android:label="@string/title_activity_create_account"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="app.createaccount" />

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

</application>
</manifest>

【问题讨论】:

  • 作为 LAUNCHER 怎么能有 2 个活动?

标签: java android android-emulator


【解决方案1】:

我想你的LoginActivity 有一个包com.example.dre.appli_app.LoginActivity

但是你的清单的包是不同的:

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.wheretas.appli_app">
...

尝试设置com.example.dre.appli_app

【讨论】:

  • 它们都被设置为同一个包 com.example.dre.appli_app
  • 尝试从您的 .CreateAccount 活动中删除 ... 块。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-06-27
  • 1970-01-01
  • 1970-01-01
  • 2015-09-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多