且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

安装在模拟器MyFirstApp但无法启动它

更新时间:2023-10-20 22:18:10

在您的清单xml文件,你需要确保你有

In your manifest xml file you need to make sure that you have

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

在您的活动定义。如果你没有看到在启动您的应用程序,然后它表明你没有android.intent.category.LAUNCHER集。

in your activity definition. If you don't see your application in the launcher then it suggests you don't have "android.intent.category.LAUNCHER" set.

您manifest文件应该有这样的事情(这不是一个完整的清单)

Your manifest file should have something like (this isn't a complete manifest)

        <application android:icon="@drawable/icon" android:label="@string/app_name">
         <activity android:name=".MyActivity"
                    android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
         </activity>
        </application>

您不能只是把意图过滤线在你的清单。如果您双击清单它将打开。你得到2种方法进行编辑,原始XML或使用基本接口。我个人认为你是用生界面更好。你看,当你双击清单打开的窗口下面,你会看到一些类似的标签清单,应用程序......最后是上AndroidManifest.xml中 - 这是原始的XML。第一个是基本设置。

You can't just put the intent-filter lines in your manifest. If you double click the manifest it will open up. You get 2 methods to edit it, raw XML or using a basic interface. Personally I think you're better off with the raw interface. Look below the window that opens when you double click the manifest, you'll see some tabs like Manifest, Application... the last on is AndroidManifest.xml - this is the raw xml. The first one is basic setup.

不要忘了保存清单文件,并做了清理并生成然后运行它。

Don't forget to save your manifest file and do a clean and build then run it.